-
Notifications
You must be signed in to change notification settings - Fork 653
Some love for UDP and IPv6 #1205
Comments
There is no real need for that, I think, you just need a valid socket file descriptor. UDP sockets on POSIX platforms are always implicitly bound to some address/port combo. (I suppose that also applies to uv_udp_set_membership().) |
But until we bind to it the fd will be -1, won't it? We already to the implicit bind on I was thinking about removing it, so the user is forced to bind it explicitly. That way, there would only be 2 ways to bind a socket: |
In the current implementation, yes. But you don't have to bind a socket in order for it to be usable: just I don't recall what the reason is for the current bind behavior. It was a long time ago and it's quite possible the choice for that approach was completely arbitrary but I imagine it has to do with the fact that getsockname() reports 0.0.0.0:0 until you start using the socket, either by sending data or by binding it. Libuv currently forces the issue with an implicit bind.
That seems reasonable but as pointed out above, binding in uv_udp_set_membership() isn't really necessary, just creating the socket is enough. |
Indeed. We now seem to always create + bind the socket.
Maybe it also had to do with the fact that if you create the socket early you'd need to get the family in
Not sure if it could be a problem, but my idea was to set I'll take a stab at the implementation and see how it feels like :-) Thanks for your comments Ben! |
We are done here! Note to self: fix #150. |
While working on adding IPv6 support to
uv_udp_set_membership
I noticed some inconsistencies / missing stuff in the UDP support which I plan to fix. Here is the list of things I'll be working on:uv_udp_bind
to accept aUV_UDP_REUSEADDR
flag and don't setSO_REUSEADDR
by default.uv_udp_set_multicast_interface
Only do implicit binding onReview where implicit binding happens and align Unxi and Windows.uv_udp_set_membership
(binding to 'any' and settingUV_UDP_REUSEADDR
, otheruv_udp_set_*
functions should probably returnUV_EBADF
. Currently Windows does implicit binding but Unix doesn't. I wonder ifuv_udp_send
anduv_recv_start
shouldn't bind the socket either.Comments are welcome! /cc @indutny @bnoordhuis.
The text was updated successfully, but these errors were encountered: