-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > I'm having a really wierd problem with a bit of C code > > I have an array of socket file descriptors that is looped though and > messages sent to. If one of the remote applications dies it causes a > broken pipe in the application... This isn't really wierd at all... This is exactly what should happen. > But when you send data from the server it _still_ return the number > of bytes in the message as if it was a good connection. ie if I > sent "Linux\0" it would return 6. I was assuming that because the > client is dead that send would fail and return send's error code > (-1) but it doesn't. And errno doesn't seem to have anything > usefull in it either :( No... That's because this condition isn't an error! (ok, I'm getting to it...) > When the send has happened however the connection finally goes away. This isn't really weird either... though I can certainly see where it could cause some confusion. Frank already told you how to fix it, but he didn't really explain why... I hope this helps clear it up. Remember, UDP is a connectionless protocol -- it does not guarantee delivery (or receipt) of packets. Unlike TCP, you can send() UDP packets to a host that's not "listening" to your heart's content, due to the conectionless nature of UDP. You don't get an error (by default) because there's no real connection... despite the fact that you may have called connect() to initiate your UDP session. All connect() does for UDP is associate a particular IP address with a socket. Contrary to the suggestion of its name, it doesn't really instantiate a connection, per se. - -- Derek Martin ddm@pizzashack.org - --------------------------------------------- I prefer mail encrypted with PGP/GPG! GnuPG Key ID: 0x81CFE75D Retrieve my public key at http://pgp.mit.edu Learn more about it at http://www.gnupg.org -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE88/dVdjdlQoHP510RAqJwAJsHAUdQ9YBE7C2guhFjRJ1zB3veEACgr+jx zcpIviYv3YYHI8nLNDqhGFk= =qmE4 -----END PGP SIGNATURE-----