Share via


Socket.SendTo Method

Sends data to an unbound socket.

Overload List

Name Description
Socket.SendTo (Byte[], EndPoint) Sends all of the data currently in the buffer array to a specified endpoint.
Socket.SendTo (Byte[], Int32, Int32, SocketFlags, EndPoint) Sends data to a specified endpoint according to specified flags, beginning at a specified location in the buffer array.
Socket.SendTo (Byte[], Int32, SocketFlags, EndPoint) Sends data to a specified endpoint, according to specified flags.
Socket.SendTo (Byte[], SocketFlags, EndPoint) Sends all of the data currently in the buffer array to a specified endpoint, according to specified flags.

Remarks

If you are using a connectionless protocol, you do not need to establish a default remote host with the Connect method before calling the SendTo method. You need to do this only if you intend to call the Send method. If you do call the Connect method before calling SendTo, the remoteEP parameter will override the specified default remote host for that send operation only.

Although intended for connectionless protocols, SendTo also works with connection-oriented protocols. If you are using a connection-oriented protocol, you must first establish a remote host connection by calling the Connect method or accept an incoming connection request by using the Accept method. If you do not establish or accept a remote host connection, SendTo will throw a SocketException exception. You can also establish a default remote host for a connectionless protocol before calling the SendTo method. In either of these cases, SendTo will ignore the remoteEP parameter and send data only to the connected or default remote host.

Version Information

Available in .NET Micro Framework version 2.0, 2.5

See Also

Reference

Socket Class
Socket Members
System.Net.Sockets Namespace