Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DatagramSocket.receive(...)

 
S Thanigaivel
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I send data of size 750 bytes from client to server using UDP.

I use the below code to receive data



The data I receive is of size 2048 bytes. Original size of my data is 750 bytes. What will be padded to the remaining 1298 bytes?
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From java api
Datagram packets are used to implement a connectionless packet delivery service. Each message is routed from one machine to another based solely on information contained within that packet. Multiple packets sent from one machine to another might be routed differently, and might arrive in any order. Packet delivery is not guaranteed.


Just send the amount of bytes that contains data.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic