Sample code for 30+ languages & platforms
Chilkat2-Python

Example: Socket.AcceptNext method

Demonstrates how to call the AcceptNext method.

Chilkat Chilkat2-Python Downloads

Chilkat2-Python
import sys
import chilkat2

success = False

listenSocket = chilkat2.Socket()
connectedSocket = chilkat2.Socket()

port = 5555
backlog = 25
success = listenSocket.BindAndListen(port,backlog)
if (success == False):
    print(listenSocket.LastErrorText)
    sys.exit()

# Accept next incoming connection
maxWaitMs = 200000
success = listenSocket.AcceptNext(maxWaitMs,connectedSocket)
if (success == False):
    print(listenSocket.LastErrorText)
    sys.exit()

# ...
# ...

maxWaitMs = 20000
connectedSocket.Close()