BytesRoad.Net.Sockets.SocketEx.BeginBind C# (CSharp) Method

BeginBind() public method

Begins an asynchronous binding.
The BeginBind method starts an asynchronous binding request. It returns immediately and does not wait for the asynchronous call to complete.

The BytesRoad.Net.Sockets.SocketEx.EndBind method is used to retrieve the results of the asynchronous call. It can be called any time after BeginBind; if the asynchronous call has not completed, EndBind will block until it completes.

The behavior of the BeginBind method depends on the proxy type specified while instance of the SocketEx class constructed. Table below represents the behavior of the method for different types of proxy server. Type of proxy server Behavior of the BeginBind method BytesRoad.Net.Sockets.ProxyType.None The socket will be bound locally to the same IP address as the instance of the SocketEx class specified by socket parameter. BytesRoad.Net.Sockets.ProxyType.HttpConnect Web proxy not support binding command. The System.InvalidOperationException would be thrown. BytesRoad.Net.Sockets.ProxyType.Socks4

-or-

BytesRoad.Net.Sockets.ProxyType.Socks4a

-or-

BytesRoad.Net.Sockets.ProxyType.Socks5
The socket will be bound at the proxy server. Port and IP address may be retrieved via BytesRoad.Net.Sockets.SocketEx.LocalEndPoint property. An instance specified by socket parameter must be connected with the remote host through physically the same proxy server as the instance of the SocketEx class on which BeginBind method are called.
/// The object was disposed. /// /// The operation is unsupported. ///
public BeginBind ( SocketEx socket, AsyncCallback callback, object state ) : IAsyncResult
socket SocketEx /// An instance of the /// class which already connected to the remote host through the proxy /// server. See remarks for more details. ///
callback AsyncCallback /// The AsyncCallback delegate. ///
state object /// An object containing state information for this request. ///
return IAsyncResult
        public IAsyncResult BeginBind(
            SocketEx socket, 
                                        AsyncCallback callback, 
                                        object state)
        {
            return (IAsyncResult)BeginTimeoutOp(
                _connectTimeout,
                new Bind_Op(_baseSocket, socket),
                callback,
                state);
        }