views:

31

answers:

1

Hello,

I have 2 processes and they send UDP messeges. They don't read the messages immeditely and sometimes when they read the messages they can read a bulk of them. I saw that when one of the processes is down the other one is still getting those messages.

How come ? it is down.

Thanks

+1  A: 

You keep getting packets after one process crashes because the OS buffers the incoming packets. See for example this discussion on UDP Buffering.

When working with unconnected UDP sockets there is no way for either pier to know if the other pier has crashed other than sending round trip keep alive packets.

Robert S. Barnes
OK.If it was TCP the buffer would still exists ?
Roman Dorevich
Yes. But you may see different behavior with TCP since if your pier closes / crashes the OS will send a FIN or RST packet indicating that the connection is closed and after you consume the remaining data in the buffer you will get a 0 length read or read error .
Robert S. Barnes