-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Can't get datagram fd without referencing internal API #8057
Comments
I'd be very happy to submit a PR which updates Perhaps since |
I think it would be better to make @indutny What do you think? BTW, "stable" simply means the user API. Not the internal implementation. |
If this issue is addressed, I'd be quite pleased if the resultant API was consistent across all of the various stream-like classes in node's js runtime. Ideally I don't think it's too unreasonable to say that if a class makes use of an fd, is stream-like, and is part of the node API, I shouldn't need any It strikes me that classes which fit those criteria would all inherit from some common subclass, anyway - perhaps |
FWIW, the function that currently gets the fd (https://github.com/joyent/node/blob/master/src/stream_wrap.cc#L70) replies on non-public libuv implementation details. |
@benjamincburns yeah, it's indeed related. Currently there is no libuv issue opened for this, and we have resisted those which wanted to expose the fd, because it's treated as an internal implementation detail. There are ways around it, but not for all cases, so we'll get to come up with something. I don't have any concrete suggestions as of now (well, the obvious |
@benjamincburns If you do, please link back to this issue for dependency tracking. |
FYI: joyent/libuv#1435 |
When I open a datagram socket using
dgram.createSocket('udp4')
, I'd expect thefd
member of the socket to be set to the socket's fd once it's been properly opened. However, it's never set there, and in order to get the socket's fd, I have to snoop on the private membersocket._handle.fd
.Why is this important to me?
I'm working on a module to implement support for TUNTAP network interfaces as an enabler of node-based virtual networks (think VPNs and VM networks). As a personal goal I'm attempting to write this module with no native code, and it's almost doable by using the ref and ioctl modules.
I say almost because while I'm able to create the TUN/TAP device, I'm not able to get/set options on it (address, broadcast, netmask, mtu) without referencing the private datagram socket API (
_handle
).Example code:
The text was updated successfully, but these errors were encountered: