(VBScript) Example: Socket.AcceptNext method
Demonstrates how to call the AcceptNext method. Note: This example requires Chilkat v11.0.0 or greater.
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
set listenSocket = CreateObject("Chilkat.Socket")
set connectedSocket = CreateObject("Chilkat.Socket")
port = 5555
backlog = 25
success = listenSocket.BindAndListen(port,backlog)
If (success = 0) Then
outFile.WriteLine(listenSocket.LastErrorText)
WScript.Quit
End If
' Accept next incoming connection
maxWaitMs = 200000
success = listenSocket.AcceptNext(maxWaitMs,connectedSocket)
If (success = 0) Then
outFile.WriteLine(listenSocket.LastErrorText)
WScript.Quit
End If
' ...
' ...
maxWaitMs = 20000
success = connectedSocket.Close()
outFile.Close
|