aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes DatagramSocket.receive(...) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "DatagramSocket.receive(...)" Watch "DatagramSocket.receive(...)" New topic
Author

DatagramSocket.receive(...)

S Thanigaivel
Ranch Hand

Joined: Oct 06, 2005
Posts: 60
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

Joined: Aug 21, 2004
Posts: 367
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.


SCJP1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DatagramSocket.receive(...)