Re: socket multithreading problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/27/10 7:04 AM, Ümit CAN wrote:
 > I use PHP socket programming  and I wish  multithreading operation of
the socket .
> When I have many requests on this  socket , before the  first one request is anwered , the second request  is not aswered  till the first one is finished.
> How can both  requests  work  together without  waiting each  other ? 

I assume you mean you have multiple sockets and not just one?  If it is
just one, you just need to write a little state machine that keeps track
of your requests since only one thing can happen at a time on a single
socket.

If you have multiple sockets you should be looking at
http://php.net/socket_select and not threads.  Threads and/or pcntl
processes would be a very inefficient way to deal with something as
simple as reading messages asynchronously from many sockets.

-Rasmus

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux