Re: working with opened sockets

From: Date: Tue, 28 Nov 2000 22:50:43 +0000
Subject: Re: working with opened sockets
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-27714@lists.php.net to get a copy of this message
You have certain expectations of what is coming and use a timed loop to get the data. while (!feof($socket) && !(time() - $lastdata > 60) && $char != "\n"){ $char = fgetchar($socket); if ($char){ $lastdata = time(); $data .= $char; } } In other words, if you work with sockets, it's partly *your* responsibility to check that the socket is still working, and giving you the data you expect. ----- Original Message ----- From: Jon <apostolj@mail.lafayette.edu> Newsgroups: php.general Sent: Tuesday, November 28, 2000 12:45 PM Subject: [PHP] working with opened sockets > It seems like most of the file functions just don't work when using opened > network sockets. One of the things I've noticed is that there seems to be > no way to get all "available" data from an opened socket cause it never > returns "feof" until the connection is closed. How can any type of > interaction ever be implemented if you can't get the data without closing > the connection? Any ideas? > > -- Jon > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#27714) next »