<?php
// hello.php
use TrueAsync\HttpServer;
use TrueAsync\HttpServerConfig;
$server = new HttpServer(
(new HttpServerConfig())
->addListener('0.0.0.0', 8611)
);
$server->addHttpHandler(function ($request, $response) {
$response
->setStatusCode(200)
->setHeader('Content-Type', 'text/plain')
->setBody('Hello, World!');
});
$server->start();
PS D:\work\async> php .\http.php
PHP Fatal error: Uncaught Async\AsyncException: Failed to bind to 0.0.0.0:8611: operation not supported on socket in D:\work\async\http.php:19
Stack trace:
#0 D:\work\async\http.php(19): TrueAsync\HttpServer->start()
#1 {main}
thrown in D:\work\async\http.php on line 19
Fatal error: Uncaught Async\AsyncException: Failed to bind to 0.0.0.0:8611: operation not supported on socket in D:\work\async\http.php:19
Stack trace:
#0 D:\work\async\http.php(19): TrueAsync\HttpServer->start()
#1 {main}
thrown in D:\work\async\http.php on line 19
error
php-trueasync-0.7.0-php8.6-windows-x64.zip