note 27644 rejected from function.socket-accept by pollita
| From: | pollita@php.net | Date: | Thu, 01 May 2003 21:56:01 +0000 |
| Subject: | note 27644 rejected from function.socket-accept by pollita | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-47361@lists.php.net to get a copy of this message | ||
Hi! With listen() we can to create a server application, as follow:
//first we must to create a socket which will be used to listen
// a connection (0 mean protocol type - TCP)
$mysock = socket_create(AF_INET, SOCK_STREAM, 0);
//now bind call a port (20000) with a socket on 127.0.0.1
//address
socket_bind($mysock, "127.0.0.1", 20000);
//accepting conenctions on a socket and port
socket_accept($mysock);
//using socket_listen we can specify how much connections
//we will to accept
socket_listen($socket, 10);
It´s very good!