Org.Mentalis.Security.Ssl.SecureSocket.BeginReceive C# (CSharp) Method

BeginReceive() public method

Begins to asynchronously receive data from a connected SecureSocket.
is a null reference (Nothing in Visual Basic). An operating system error occurs while accessing the SecureSocket. SecureSocket has been closed. The offset parameter is outside the bounds of buffer or size is either smaller or larger than the buffer size.
public BeginReceive ( byte buffer, int offset, int size, SocketFlags socketFlags, AsyncCallback callback, object state ) : IAsyncResult
buffer byte The storage location for the received data.
offset int The zero-based position in the buffer parameter at which to store the received data.
size int The number of bytes to receive.
socketFlags SocketFlags A bitwise combination of the values.
callback AsyncCallback The delegate.
state object An object containing state information for this request.
return IAsyncResult
		public override IAsyncResult BeginReceive(byte[] buffer, int offset, int size, SocketFlags socketFlags, AsyncCallback callback, object state) {
			if (SecureProtocol == SecureProtocol.None)
				return base.BeginReceive(buffer, offset, size, socketFlags, callback, state);
			if (!Connected && m_SentShutdownNotification)
				throw new SocketException();
			if (buffer == null)
				throw new ArgumentNullException();
			if (offset < 0 || (offset >= buffer.Length && size != 0) || size > buffer.Length - offset)
				throw new ArgumentOutOfRangeException();
			return m_Controller.BeginReceive(buffer, offset, size, callback, state);
		}
		/// <summary>

Usage Example

Example #1
0
	///<summary>Starts the authentication process.</summary>
	///<param name="Connection">The connection with the SOCKS client.</param>
	///<param name="Callback">The method to call when the authentication is complete.</param>
	internal override void StartAuthentication(SecureSocket Connection, AuthenticationCompleteDelegate Callback) {
		this.Connection = Connection;
		this.Callback = Callback;
		try {
			Bytes = null;
			Connection.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, new AsyncCallback(this.OnRecvRequest), Connection);
		} catch {
			Callback(false);
		}
	}
All Usage Examples Of Org.Mentalis.Security.Ssl.SecureSocket::BeginReceive