I am using DatagramSockets for UDP multicast - Java implementation j2se 1.4.2 , and there is a problem :
there is server that recieves "I am alive" signals from many clients . The server runs in a loop with : receive( p) .
Now if he has to get 2 Datagrams - at the same time he fails , meaning he only gets one .
I am 99% shure it has nothing to do with the UDP protocol ( best efford) , but with both of them ariving at the same time .
Is there any way around it still using UDP ?
There shouldn't be any problems with datagrams arriving at the same time. Your server should be able to receive them and process them all. However, UDP is "best effort" which means that those UDP packets may get dropped and never make it to your server. I would also strongly recommend running a threaded server where your main server thread accepts the datagram packets and then dispatches to "worker" threads to process the datagram packets. That way your main server thread just handles reception of the UDP packets. You may also want to look into the NIO (non-blocking IO) for Java if you really want to go all the way.