-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 04/21/2014 04:40 PM, Iñaki Baz Castillo wrote: > 2014-04-21 15:58 GMT+02:00 Iñaki Baz Castillo <[email protected]>: >> I connect two Unix Domain Sockets in datagram mode using >> socketpair(): >> >> socketpair(AF_UNIX, SOCK_DGRAM, 0, fds); >> >> And then, I create two uv_pipe_t and pass each of them one of the >> fds: >> >> err = uv_pipe_open(myPipe, fd); >> >> >> So now I can write into one side of the pipe and the other >> receives it. Perfect. >> >> >> The problem is that when one side of the pipe closes its sockets, >> the remote side does not realize of it (uv_read_cb is not fired >> with UV_EOF). Note that I've tried to close the socket in two >> ways: >> >> 1) by calling uv_close(handle) 2) by calling close(fd) (in >> #include <unistd.h>) >> >> None of them causes the remote to be notified. > > > UPDATE: if side A closes its pipe side (by calling close(fd)) the > later side B calls to uv_shutdown(pipe) then the uv_shutdown_cb > receives an error "socket is not connected". This means that side B > *can* be aware that the other side has closed its socket. Should > then side B expect a UV_EOF in the un_read_cb? (note however that > it does not happen). >
Hum. Maybe it has to do with the fact that SOCK_DGRAM will create a connection-less socketpair? That is, both know what the other end is, but it's not connected as in TCP. So, what your test seems to show is that you can only detect failure when you try to send something over the connection. You probably want to give SOCK_SEQPACKET a try, but AFAIK is a bit more cumbersome to use. - -- Saúl Ibarra Corretgé bettercallsaghul.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Using GnuPG with Icedove - http://www.enigmail.net/ iQIcBAEBAgAGBQJTVhDnAAoJEEEOVVOum8BZubYP/ioFy8my9d9QcoDzZa2/lx5y qghFO7N9o8cptLDAjuy4QlFJxTEpR4vfRhXMmXqhhFT+AfQxe5nDrz6G/5HZVo/u FQVUYHrJ117NGHkGZ2liXMT9Z4ZW4xS9MGwau4KMT4jex/XgJjxhCp0gBig+PPn1 c3nxxJJI/W1oy/EBr0T0pvaOuuHJ4t/VWwrYNgYz1cMSeWwDUzdlMHP0LkU6Klre FSzIYYc2RWGPhHvBc383BtB3MhNYPJv/OghvAiq3U52rAbmVZ9f0scMcxxpK8V+e m8nAMs/rx4fubNZZ4a3N70kvVocpAz8vjo8ot1AO5WI0lAACQRpKqsmlB16Sg+YD +dbuS0S5KBTy+qmGnYoMhrab2fIiqlhPX7Wl25JIJkE9T55OONl2SIgPNTYjHNwy P5sa1ooyOW+Z8gzpurH0Atfykgkqy1rZkRdVHHhvHZM+naXVUGaWFpA1YO2uBNhC eTQwpSbz1xEXTz+ETQdPW7pYbj+QcmP3Agpb0dLpGSvG1U6lHG5tPnXgwQ/j2w7H Ve+IT8CvhFLYlVuOal1fQBdh+stOppzSJlkQEU3G5lfcnLKVRUXPOWBtAOwebd9f RndYXMsKgRUc4AeExsgMD2SeDSe3laziP0EckQ6K0Vsjj2L7E1l51Xs+Hcm05z2s yGp9StRYqL62sWxO48QD =kISB -----END PGP SIGNATURE----- -- 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.
