Mono Class Library: System.Net.Sockets.Socket Overview | MembersSystem.Net.Sockets.Socket.Listen Method |
Places the current instance into the listening state where it waits for incoming connection requests. [Edit]
|
Type Reason System.Net.Sockets.SocketException The Socket.Connected property of the current instance is true. -or-
Bind has not been called on the current instance.-or-
An error occurred while accessing the socket.Note: For additional information on causes of the SocketException, see the System.Net.Sockets.SocketException class.[Edit]ObjectDisposedException The current instance has been disposed. [Edit]
Once this method is called, incoming connection requests are placed in a queue. The maximum size of the queue is specified by the backlog parameter. The size of the queue is limited to legal values by the underlying protocol. Illegal values of the backlog parameter are replaced with a legal value, which is implementation defined.
If a connection request arrives and the queue is full, a System.Net.Sockets.SocketException is thrown on the client.
A socket in the listening state has no remote endpoint associated with it. Attempting to access the Socket.RemoteEndPoint property throws a System.Net.Sockets.SocketException exception.
This method is ignored if called more than once on the current instance.
Note:[Edit]This method is used only on the server-side of connection-oriented protocols. Call the Socket.Bind(System.Net.EndPoint) method before this method is called the first time. Call the Socket.Listen(int) method before the first call to the Socket.Accept method.
Namespace: System.Net.Sockets
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0