Sample code for 30+ languages & platforms
VBScript

Example: Socket.AcceptNext method

Demonstrates how to call the AcceptNext method.

Chilkat VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

success = 0

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