Mentalis.org Security Library documentation

VirtualSocket.Send Method (Byte[], SocketFlags)

Sends data to a connected VirtualSocket, starting at the indicated location in the data.

[Visual Basic]
Overridable Overloads Public Function Send( _
   ByVal buffer As Byte(), _
   ByVal socketFlags As SocketFlags _
) As Integer
[C#]
public virtual int Send(
   byte[] buffer,
   SocketFlags socketFlags
);

Parameters

buffer
The data to be sent.
socketFlags
A bitwise combination of the SocketFlags values.

Return Value

The number of bytes sent to the VirtualSocket.

Remarks

Use Send for connection-oriented protocols only. For connectionless protocols, either use SendTo or call Connect first, and then call Send.

This overload only requires you to provide a data buffer and SocketFlags. The offset defaults to 0, and the size parameter defaults to the buffer length.

You must set the LocalEndPoint property of the current instance before calling this method.

If you specify the DontRoute flag as the socketflags parameter, the data you are sending will not be routed. If you specify the OutOfBand flag as the socketflags parameter, only out-of-band (OOB) data is sent.

If you set the Blocking property to true, and buffer space is not available within the underlying protocol, this method blocks.

If you are using a message-oriented Socket, and the size of the buffer is greater than the maximum message size of the underlying protocol, no data is sent and Socket will throw a SocketException.

Exceptions

Exception TypeCondition
ArgumentNullExceptionbuffer is a null reference (Nothing in Visual Basic).
SocketExceptionAn operating system error occurs while accessing the socket.
ObjectDisposedExceptionThe VirtualSocket has been closed.

See Also

VirtualSocket Class | Org.Mentalis.Security.Ssl Namespace | VirtualSocket.Send Overload List