How does Java handle multiple UDP packets receipt? -


imagine following scenario in udp packets:

  1. server broadcasts "hello" message , waits answers
  2. client 1 answers "hi"
  3. client 2 answers "hi"

now, i'm interested happens server if second answer received before server finished processing first answer.

on 1 hand, udp design unreliable, , since haven't called datagramsocket.receive(mypacket) second time, assume second answer silently discarded.

on other hand, socket still open, maybe java (or lower level, in kernel network stack) queue packet.

what happen in case?

the os's network stack buffers datagram.

as long socket remains open, additional calls .receive() fetch datagram contents.

if socket closed while packets buffered, they're silently discarded.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -