-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get client(remote) port #1034
Comments
Technically that should be possible, but where is this needed? |
Thank you for the answer! After some internal discussion with team we decided to proceed without remotePort information. It was needed for debug purposes before. But it's not an important information for the moment. |
I'd like this feature. I need it for controlling many clients and they all use RemotePorts. I'd like to have some kind of function to retrieve it. |
Why was this closed if this didn't actually get implemented? |
It is implemented. It's called something like us_socket_remote_address or similar. Look in uSockets |
Oh has this been exposed on uWebSockets.js? |
I couldn't get the remote port out of that function. But I got it using the following technique. Testing shows it works, but is it safe to cast
|
Interesting, looks like there is only int us_socket_local_port(int ssl, struct us_socket_t *s); Why would you need ephemeral port? You can PR the feature as int us_socket_remote_port(int ssl, struct us_socket_t *s); |
I want to log it along with other logs related to my app. Sometimes my logs don't have enough info so I use other tools like Wireshark and lsof which also show the ephemeral port. I want to cross-reference the many connections in these tools with the logs in my uWebSockets app. I'll try to add the function you suggested. |
Thanks for accepting my PR. That means you can close this issue. |
Hi!
There is a function to get the remote IP address.
But how to get the remote port. Is it possible?
The text was updated successfully, but these errors were encountered: