2014-04-27 13:47 GMT+02:00 Iñaki Baz Castillo <[email protected]>:
> I'm building a RTP media server which means I need to bind in many
> random UDP ports: for each RTP session I need two sequential ports,
> the first for RTP (ex: 15054) and the second for RTCP (ex: 15055).
>
> This means that I will check for random ports (I don't want to keep a
> list of "used ports" because I use N threads with separate UV loops
> and don't want to access shared memory) so uv_udp_bind() may fail with
> EADDRINUSE.
>
> In that case, could I reuse the same uv_udp_t pointer with a new sockaddr?
> If so, do I need to call uv_udp_init again for the same handle?
Humm, in uv__udp_bind() I see:
--------------------------------------
if (bind(fd, addr, addrlen)) {
err = -errno;
goto out;
}
[...]
return 0;
out:
uv__close(handle->io_watcher.fd);
handle->io_watcher.fd = -1;
return err;
----------------------------------
So it seems that the socket gets invalidated after uv_udp_bind()
fails, and thus I cannot reuse the uv_udp_t handle again with another
address, am I right?
--
Iñaki Baz Castillo
<[email protected]>
--
You received this message because you are subscribed to the Google Groups
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.