-
-
Notifications
You must be signed in to change notification settings - Fork 157
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
Also expose port for each connection #26
Comments
See also reactphp/reactphp#199 |
Alternatively it would be great to at least not remove it from the address. Are there any plans to add this to the interface at some point? I'm not sure what the downside is of adding a getter for the port that returns Is any development / discussion on this topic being held elsewhere? |
This ticket has received little interest so far. Care to change this an file a PR? :)
I think this is what makes most sense, see also reactphp/reactphp#199 for more details. |
@clue I've read reactphp/reactphp#199, the issue is that the longer we wait with making a choice the more libraries will break when we do decide to change it. Just returning the result from I'm definitely available to make a PR but let's first agree on the desired direction. |
Care to elaborate what your opinion is based on?
I agree that this would be the cleanest and totally overkill solution :) |
Well the whole point of implementing a |
For the most part, Technically, the "port" is part of the "address" (for TCP/IP anyway). We could introduce a second accessor method for the remote port and then rename the first method to make it obvious it does not include the port. However, this would be a leaky abstraction as we've now leaked the detail that we focus on TCP/IP connections and other protocols do not know the concept of a "port". Alternatively, we could change the single accessor method to return the full address. The string format returned by the underlying I agree that having an interface (kind of like PSR-7's As such, I'm in favor of using a single method to access the URI and I'm not really convinced an additional interface is actually worth the hassle. I'm curious what others think about this? |
That sounds ok to me, and I agree that doing a true abstraction requires too much overhead and a leaky abstraction is not what we want; so that leaves |
Currently, the
Connection::getRemoteAddress()
method only returns the IP address of the remote peer.There's currently no way to access its TCP/IP port.
It's quite trivial to add a
getRemotePort()
method, but we should think twice about whether we should limit ourselves to TCP/IP here.Other schemes (such as Unix or perhaps even raw sockets) do not have a concept of "ports" and may not necessarily build on top of IP.
As such, we should consider just returning the full remote peer address from the
getRemoteAddress()
method.The text was updated successfully, but these errors were encountered: