Ruby
Ruby
Example: Socket.AcceptNext method
Demonstrates how to call the AcceptNext method.Chilkat Ruby Downloads
require 'chilkat'
success = false
listenSocket = Chilkat::CkSocket.new()
connectedSocket = Chilkat::CkSocket.new()
port = 5555
backlog = 25
success = listenSocket.BindAndListen(port,backlog)
if (success == false)
print listenSocket.lastErrorText() + "\n";
exit
end
# Accept next incoming connection
maxWaitMs = 200000
success = listenSocket.AcceptNext(maxWaitMs,connectedSocket)
if (success == false)
print listenSocket.lastErrorText() + "\n";
exit
end
# ...
# ...
maxWaitMs = 20000
connectedSocket.Close()