Skip to content

Conversation

@clue
Copy link
Member

@clueclue commented Feb 5, 2017

The getPort() currently only returns the "port" part and explicitly omits the listening IP. This has been documented as of v0.4.4 and has in fact been like this ever since this method has been added.

This PR replaced this method with a getAddress() method that it returns the full remote address, i.e. IP and port.

- echo $server->getPort();- 8000+ echo $server->getAddress();+ 192.168.0.12:8000

This is obviously a BC break, so I've made sure to add documentation on how to get only the port from the full address with a one-liner.

Empirical evidence seems to suggest the old getPort() method isn't used that much and is mostly used in a context where the full URI likely makes more sense anyway. For TCP/IP based servers, the full URI contains the port and with the above one-liner this switch should be easy.

There are plenty of reasons, let me try to list a few here:

@clueclue added this to the v0.5.0 milestone Feb 5, 2017
jsor
jsor approved these changes Feb 5, 2017
@clueclue merged commit 2d5a2e5 into reactphp:masterFeb 5, 2017
@clueclue deleted the getaddress branch February 5, 2017 15:49
@clueclue mentioned this pull request Feb 5, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@clue@jsor@WyriHaximus