node.js - Determining the remote port of the http request in expressjs -



node.js - Determining the remote port of the http request in expressjs -

hi want know remote port of request express web server. api has mechanism determine remote ip not find way determine port.

particularly node, documentation http server component, under event connection says:

[triggered] when new tcp stream established. [the] socket object of type net.socket. users not want access event. in particular, socket not emit readable events because of how protocol parser attaches socket. socket can accessed @ request.connection.

so, means request.connection socket , according documentation there indeed socket.remoteport attribute according documentation is:

the numeric representation of remote port. example, 80 or 21.

so, guess should able remote address , port accessing attributes in request.connection.remoteaddress , request.connection.remoteport or subscribing event mentioned above.

node.js express

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -