You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
net.Server.address() returns a string instead of an object for Pipes #12895
According to the documentationserver.address() should return an object with port, family, and address properties but if I call it on a HTTP server connected via windows pipe (on IIS Node on Windows Azure) I get a plain string telling the pipe name.
Is this just a documentation issue or should the return value for the pipe case adapted somehow (even port/familiy doesn't make that much sense for a pipe).
changed the title [-]net.Server.address() returns a string instead of an object[/-][+]net.Server.address() returns a string instead of an object for Pipes[/+]on May 8, 2017
As far as I know there is no API to check if a Server is using a Pipe or TCP besides checking the type of the internal _handle member which is not that nice.
Not sure if such an API is worth to add.
Not sure if it is really possible as anything with an _handle or fd member can be passed to listen therefore it's not really possible to tell what the server is actually listening on.
I’d prefer just documenting this rather than risking breakage. As @Flarna pointed out, there wouldn’t really be any point in switching to an object.
🤔 is would be nice to have a way to get the type of underlying medium, so we could know what to expect from server.address() (AFAIK is could be an; fd / UNIX socket / TCP socket / Windows Pipe)
Activity
[-]net.Server.address() returns a string instead of an object[/-][+]net.Server.address() returns a string instead of an object for Pipes[/+]refack commentedon May 8, 2017
Hello @Flarna could you provide a code snippet?
addaleax commentedon May 8, 2017
I’d prefer just documenting this rather than risking breakage. As @Flarna pointed out, there wouldn’t really be any point in switching to an object.
Flarna commentedon May 8, 2017
It's also applicable to Linux but there it's not a named pipe it's an unix domain socket which is handled by the same class in node.
see net.js:
Flarna commentedon May 8, 2017
As far as I know there is no API to check if a Server is using a Pipe or TCP besides checking the type of the internal
_handlemember which is not that nice.Not sure if such an API is worth to add.
Not sure if it is really possible as anything with an
_handleorfdmember can be passed to listen therefore it's not really possible to tell what the server is actually listening on.addaleax commentedon May 8, 2017
@Flarna Doesn’t checking the return type of
.address()basically do that? ;)refack commentedon May 8, 2017
🤔 is would be nice to have a way to get the
typeof underlying medium, so we could know what to expect fromserver.address()(AFAIK is could be an; fd / UNIX socket / TCP socket / Windows Pipe)Flarna commentedon May 8, 2017
As long as we have only TCP and Pipes it's fine. Not sure if all usecases of
listen()nail down to this two cases.addaleax commentedon May 8, 2017
@Flarna Yes, those two are the only supported options (for
net.Servers, at least). :)doc: add docs for server.address() for pipe case
doc: add docs for server.address() for pipe case
doc: add docs for server.address() for pipe case
Stop casting to `net.AddressInfo` type as that should already be infe…
doc: add docs for server.address() for pipe case