Sample code for 30+ languages & platforms
C#

Example: Socket.AcceptNext method

Demonstrates how to call the AcceptNext method.

Chilkat C# Downloads

C#
bool success = false;

Chilkat.Socket listenSocket = new Chilkat.Socket();
Chilkat.Socket connectedSocket = new Chilkat.Socket();

int port = 5555;
int backlog = 25;
success = listenSocket.BindAndListen(port,backlog);
if (success == false) {
    Debug.WriteLine(listenSocket.LastErrorText);
    return;
}

//  Accept next incoming connection
int maxWaitMs = 200000;
success = listenSocket.AcceptNext(maxWaitMs,connectedSocket);
if (success == false) {
    Debug.WriteLine(listenSocket.LastErrorText);
    return;
}

//  ...
//  ...

maxWaitMs = 20000;
connectedSocket.Close();