Dart.Sockets Namespace > UdpBase Class > Send Method : Send(String,IPEndPoint) Method |
'Declaration Public Overloads Function Send( _ ByVal buffer As String, _ ByVal destination As IPEndPoint _ ) As Datagram
'Usage Dim instance As UdpBase Dim buffer As String Dim destination As IPEndPoint Dim value As Datagram value = instance.Send(buffer, destination)
public Datagram Send( string buffer, IPEndPoint destination )
public: Datagram* Send( string* buffer, IPEndPoint* destination )
public: Datagram^ Send( String^ buffer, IPEndPoint^ destination )
Exception | Description |
---|---|
System.ArgumentNullException | buffer is null. |
System.Net.Sockets.SocketException | The remote address is unknown, invalid, or unable to be resolved. |
System.ArgumentOutOfRangeException | The remote port is out of the range of valid values. |
Use the Send method to send a datagram created from the data contained in buffer to the specified hostNameOrAddress. buffer is converted to a byte array before sending.
A UDP datagram provides little functionality over an IP datagram, adding a port number field (allows demultiplexing on the receiving host) and a checksum field (provides basic error handling). Unlike TCP, UDP datagrams are sent as a unit. If Send is called 3 times to send 3 datagrams to a host, the receiving host will have to call Receive 3 times. Also, the size of each datagram sent will equal the size of each datagram received by the receiving host. In addition, since UDP is a connectionless protocol, any datagrams sent to the host are not guaranteed to be delivered. Therefore, any required error checking (outside of UDP's checksum implementation) will have to be done by the application-layer protocol.
To send a broadcast datagram, use "255.255.255.255" as the remote address. To send a multicast datagram, use the multicast group address as the remote address after first joining a multicast group by using JoinMulitcastGroup.