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

Example: Socket.AcceptNext method

Demonstrates how to call the AcceptNext method.

Chilkat PHP Downloads

Chilkat2 PHP
<?php

use Chilkat2\Socket;

$listenSocket = new Socket();
$connectedSocket = new Socket();

$port = 5555;
$backlog = 25;
try {
    $listenSocket->BindAndListen($port, $backlog);

    // Accept next incoming connection
    $maxWaitMs = 200000;
    $listenSocket->AcceptNext($maxWaitMs, $connectedSocket);
} catch (\Chilkat2\Exception $e) {
    echo $e->getMessage(), "\n";
    exit;
}

// ...
// ...

$maxWaitMs = 20000;
$connectedSocket->Close($maxWaitMs);