CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Using IO::Select in multi-client environment

 



dbar1
New User

Feb 16, 2007, 9:00 AM

Post #1 of 1 (721 views)
Using IO::Select in multi-client environment Can't Post

Hi,
I am trying to use select call in multi-client model.
Here's what my code does.
# Create a socket
$sockSel = new IO::Select( $servSock );

while ( @ready = $sockSel->can_read )
{
foreach $fh ( @ready )
if ( $fh == $servSock )
{
$newConn = $servSock->accept();
$sockSel->add($newConn);
}
else
{
$fh->recv($sockBuff,$maxLenMsg);
if($sockBuff)
{ # Process sockBuff
}
}
}

Now, when one client connects, my code blocks till the sockBuff from that client is processed. In the meantime, it cannot serve any other clients.
Is there a way around this? I want to serve the next client when the 1st client is getting processed. Can I avoid threads and still achieve this with select? Thanks

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives