Hi,
While playing around with libuv I noticed we don't have support for
'connecting' a UDP socket, nor for sending data to such a socket.
I'd like to have it so I thought about a straightforward API, but Bert
raised some interesting questions on IRC, so lets discuss :-)
My proposal:
uv_udp_connect / uv_udp_connect6 -> connects the udp socket. AFAIK this
doesn't block on UDP, so it would just take the handle and sockaddr_in
or sockaddr_in6 as arguments.
For sending I have 2 options:
uv_udp_send becomes uv_udp_sendto.
a new uv_udp_send which doesn't take the remote address as an argument
or
allow passing NULL as the remote address to uv_udp_send
Bert suggested that conencted UDP sockets look like streams so maybe we
should consider them so.
IMHO that's a bit of a stretch. At least at the libuv level. If we would
do that, what about the not connected UDP sockets? What would
uv_shutdown do? If at a higher level someone wants to treat connected
UDP sockets as streams that's fine though.
Thoughts?
--
Sa�l Ibarra Corretg�
http://saghul.net/blog |
http://about.me/saghul