DatagramSocket.Receive(DatagramPacket) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Receives a datagram packet from this socket.
[Android.Runtime.Register("receive", "(Ljava/net/DatagramPacket;)V", "GetReceive_Ljava_net_DatagramPacket_Handler")]
public virtual void Receive (Java.Net.DatagramPacket? p);
[<Android.Runtime.Register("receive", "(Ljava/net/DatagramPacket;)V", "GetReceive_Ljava_net_DatagramPacket_Handler")>]
abstract member Receive : Java.Net.DatagramPacket -> unit
override this.Receive : Java.Net.DatagramPacket -> unit
Parameters
the DatagramPacket
into which to place
the incoming data.
- Attributes
Exceptions
if an error occurs while receiving the packet.
Remarks
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 packet's length, the message is truncated.
If there is a security manager, a packet cannot be received if the security manager's checkAccept
method does not allow it.
Java documentation for java.net.DatagramSocket.receive(java.net.DatagramPacket)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.