Associates the current instance with a local endpoint.
- local_end
- The local System.Net.EndPoint to be associated with the socket.
Type Reason System.Net.SocketPermission Requires permission to accept connections on the endpoint defined by localEP. See System.Net.NetworkAccess.Accept.
Type Reason ArgumentNullException localEP is null. System.Net.Sockets.SocketException Note: For additional information on causes of the SocketException, see the System.Net.Sockets.SocketException class.ObjectDisposedException The current instance has been disposed. System.Security.SecurityException A caller in the call stack does not have the required permission.
This method sets the Socket.LocalEndPoint property of the current instance to localEP.
Note:For connection-oriented protocols, this method is generally used only on the server-side and is required to be called before the first call to the Socket.Listen(int) method. On the client-side, binding is usually performed implicitly by the Socket.Connect(System.Net.EndPoint) method.
For connectionless protocols, the Socket.Connect(System.Net.EndPoint)Socket.SendTo(Byte[], int, int, SocketFlags, System.Net.EndPoint), and Socket.BeginSendTo(Byte[], int, int, SocketFlags, System.Net.EndPoint, AsyncCallback, object) methods bind the current instance to the local endpoint if the current instance has not previously been bound.
Namespace: System.Net.Sockets
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0