Re: Package proposal: Sockets

From: Date: Sun, 23 Mar 2003 13:28:12 +0000
Subject: Re: Package proposal: Sockets
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-14559@lists.php.net to get a copy of this message
Am Fre, 2003-03-21 um 23.18 schrieb Stephan Seidt: > $socket = Socket::factory('www.example.com', 80, SOCKET_TCP, SOCKET_CLIENT); > > I know that a basic tcp socket in its initial state can be used as > client or server by choosing either a connect call to get connected to > a remote socket or to use the bind, listen and accept functions to > establish a server socket which is waiting for other connections. > But there must also be a function to 'activate' the socket, e.g.: > > $socket->activate() // $socket->run() // $socket->create() > > But the following solution is imho also a good solution: > > $socket = Socket::Factory('www.example.com', 80, SOCKET_TCP); > > $socket->connect(); // To connect to the remote socket > $client = $socket->listen(); // To act as a server (listen) socket What purpose does the first parameter of the factory method have, when running the package in server-mode? I suppose it's the hostname or the IP address where the server should listen on, right? > What's your opinion about that? I'm wondering if your code can be merged with the existing Net_Socket. Did you already think about this? Apart from that, the example looks pretty cool. Is the source code available somewhere? - Martin

« previous php.pear.dev (#14559) next »