Re: Keeping a socket open

From: Date: Wed, 29 Nov 2000 08:19:38 +0000
Subject: Re: Keeping a socket open
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-27789@lists.php.net to get a copy of this message
I'm afraid it doesn't happend like. My code looks like this $a=fread($fp,3); //some code to process the first 3 bytes while(!feof($fp)){ $b.=fread($fp,1); } The problem appears after reading the first 3 bytes because the Java server report "broken pipe" and $b is empty. I don't know what happens with the opened socket but it surely doesn't stay open. I've also tried to use set_socket_blocking() with true and false values. Ovidiu -----Mesaj original----- De la: Ignacio Vazquez-Abrams [mailto:ignacio@openservices.net] Trimis: Monday, November 27, 2000 6:04 PM Catre: Ovidiu EFTIMIE Cc: Php-General Subiect: Re: [PHP] Keeping a socket open On Mon, 27 Nov 2000, Ovidiu EFTIMIE wrote: > Hi, > I have protocol between an application server (writen in Java) and a client > who can send a command(opening a socket) to the app server and then waits > for the answer. > Is there a way to read for example the first byte of the answer , verify > this byte and then read a specified lenght without closing the socket? > > Thanx, > Ovidiu > AFAIK, only two conditions will close a socket: 1) Closing it manually, and 2) Letting the script end. If neither of these happen, the socket will still be open. -- Ignacio Vazquez-Abrams <ignacio@openservices.net>

« previous php.general (#27789) next »