Places a socket in a listening state.
[Visual Basic] Public Function Listen( _ ByVal backlog As Integer _ ) As Integer [C#] public int Listen( int backlog ); [C++] public: int Listen( int backlog ); [JScript] public function Listen( backlog : int ) : int;
0 if no error occurs; otherwise, returns an non-zero error code.
If Listen is successful, Connected is set to true.
Bind must be called before Listen.
If Listen returns a non-zero result, the following code will write the error code to the console:
[C#]
result = aSocket.Shutdown if (result <> 0) { Console.WriteLine("Winsock error: " + Convert.ToString(Marshal.GetLastWin32Error()) ); }
Socket Class | Socket Members | System.Net.Sockets Namespace