NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Socket.Listen

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;

Parameters

backlog
Maximim length of the queue of pending connections.

Return Value

0 if no error occurs; otherwise, returns an non-zero error code.

Remarks

If Listen is successful, Connected is set to true.

Bind must be called before Listen.

Example [C#]

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()) );

}

See Also

Socket Class | Socket Members | System.Net.Sockets Namespace