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

Example: Socket.AcceptNext method

Demonstrates how to call the AcceptNext method.

Chilkat PHP Extension Downloads

PHP Extension
<?php

include("chilkat.php");

$success = false;

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

$port = 5555;
$backlog = 25;
$success = $listenSocket->BindAndListen($port,$backlog);
if ($success == false) {
    print $listenSocket->lastErrorText() . "\n";
    exit;
}

//  Accept next incoming connection
$maxWaitMs = 200000;
$success = $listenSocket->AcceptNext($maxWaitMs,$connectedSocket);
if ($success == false) {
    print $listenSocket->lastErrorText() . "\n";
    exit;
}

//  ...
//  ...

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

?>