DatagramSocket.receive
Class Overview | Class Members |
This Package |
All Packages
public synchronized void receive( DatagramPacket p ) throws IOException
Parameters
- p
- the DatagramPacket into which to place
the incoming data.
Description
Receives a datagram packet from this socket. When this method
returns, the DatagramPacket's buffer is filled with
the data received. The datagram packet also contains the sender's
IP address, and the port number on the sender's machine.
This method blocks until a datagram is received. The
length field of the datagram packet object contains
the length of the received message. If the message is longer than
the buffer length, the message is truncated.
Exceptions
IOException
if an I/O error occurs.
See Also
DatagramPacket, DatagramSocket