Sample code for 30+ languages & platforms
PowerShell Requires Chilkat v11.0.0+

Example: Socket.AcceptNext method

Demonstrates how to call the AcceptNext method.

Chilkat PowerShell Downloads

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

$success = $false

$listenSocket = New-Object Chilkat.Socket
$connectedSocket = New-Object Chilkat.Socket

$port = 5555
$backlog = 25
$success = $listenSocket.BindAndListen($port,$backlog)
if ($success -eq $false) {
    $($listenSocket.LastErrorText)
    exit
}

#  Accept next incoming connection
$maxWaitMs = 200000
$success = $listenSocket.AcceptNext($maxWaitMs,$connectedSocket)
if ($success -eq $false) {
    $($listenSocket.LastErrorText)
    exit
}

#  ...
#  ...

$maxWaitMs = 20000
$connectedSocket.Close()