Open Bug 1485086 Opened 6 years ago Updated 2 years ago

Add address field to the TCPServerSocket API

Categories

(Core :: Networking, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: irakli, Unassigned)

References

(Blocks 1 open bug, )

Details

(Whiteboard: [necko-triaged])

At the moment TCPServerSocket API does not expose an address of the socket clients could connect to. jdm said it was not intentional, I would like to extend an API to expose address as users of [libdweb](https://github.com/mozilla/libdweb) run into this limitation as they attempt to port their programs from node that does happen to expose address https://nodejs.org/dist/latest-v10.x/docs/api/net.html#net_server_address
I can tackle this issue myself assuming there is no argument against proposed change
Comment under getAddress suggests following: > Returns the address to which this server socket is bound. Since a server socket may be bound to multiple network devices, this address may not necessarily be specific to a single network device. In the case of an IP socket, the IP address field would be zeroed out to indicate a server socket bound to all network devices. Therefore, this method cannot be used to determine the IP address of the local system. See nsIDNSService.myHostName() if this is what you need. Am I wrong at interpreting that as socket will bind to all available network interfaces ? And if so would not [nsINetworkInfoService.listNetworkAddresses](https://dxr.mozilla.org/mozilla-beta/source/netwerk/base/nsINetworkInfoService.idl#44) be better choice than suggested nsIDNSService.myHostName ?
Priority: -- → P3
Whiteboard: [necko-triaged]
(In reply to Irakli Gozalishvili [:irakli] [:gozala] [@gozala] from comment #2) > Comment under getAddress suggests following: > > > Returns the address to which this server socket is bound. Since a server socket may be bound to multiple network devices, this address may not necessarily be specific to a single network device. In the case of an IP socket, the IP address field would be zeroed out to indicate a server socket bound to all network devices. Therefore, this method cannot be used to determine the IP address of the local system. See nsIDNSService.myHostName() if this is what you need. > > Am I wrong at interpreting that as socket will bind to all available network > interfaces ? It seems so. It could probably call nsServerSocket::InitWithAbstractAddress (only available on Linux) or nsServerSocket::InitWithAddress to only bind to one address. > And if so would not > [nsINetworkInfoService.listNetworkAddresses](https://dxr.mozilla.org/mozilla- > beta/source/netwerk/base/nsINetworkInfoService.idl#44) be better choice than > suggested nsIDNSService.myHostName ? It seems so. Not exactly sure how this API will be used by libdweb, but we should consider if sharing the network addresses and/or myHostName with dweb peers could constitute a privacy leak.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.