Re: Re: Package proposal: Sockets
| From: | Michael Bretterklieber | Date: | Mon, 24 Mar 2003 17:30:41 +0000 |
| Subject: | Re: Re: Package proposal: Sockets | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-14573@lists.php.net to get a copy of this message | ||
Hi,
Stephan Seidt schrieb:
>> please think also about implementing server-sockets for supporting
>> more then one client-connection, otherwise server-sockets are not very
>> useful.
>
>
> Hm, a server socket just means listen socket.
> The accept call usually returns a server socket.
> What you mean has to be implemented in some Socket-Server package.
> It could consist of a socket list, data handling options, etc.
> Should we call it SOCKET_LISTEN and not SOCKET_SERVER then?
SERVER_SOCKET is ok. But the package should contain any code for
handling many server-sockets simultaneously. Each accept call returns a
new socket - one per client-connection. There are some ways to handle
simultaneous connections:
- forking
- threading
- select()
the first two are a bit problematic implementing with PHP, so the only
way is to use the select() syscall (=socket_select()). The select()
syscalls returns when one of the given descriptors (sockets) is ready
for reading, writing or an exception occured.
I attached a small prototype, wich demonstrates such implementation,
bye,
--
------------------------------- -------------------------------------
Michael Bretterklieber - Michael.Bretterklieber@jawa.at
JAWA Management Software GmbH - http://www.jawa.at
Liebenauer Hauptstr. 200 -------------- privat ---------------
A-8041 GRAZ GSM: ++43-(0)676-93 96 698
Tel: ++43-(0)316-403274-12 E-mail: michael@bretterklieber.com
Fax: ++43-(0)316-403274-10 http://www.bretterklieber.com
------------------------------- -------------------------------------
"...the number of UNIX installations has grown to 10, with more
expected..." - Dennis Ritchie and Ken Thompson, June 1972