PHP 4.0 Bug #6200 Updated: fputs doesn't send, do not fflush after fgets.

From: Date: Tue, 30 Jan 2001 10:00:48 +0000
Subject: PHP 4.0 Bug #6200 Updated: fputs doesn't send, do not fflush after fgets.
Groups: php.dev 
Request: Send a blank email to php-dev+get-45362@lists.php.net to get a copy of this message
ID: 6200 Updated by: sniper Reported By: kh.wild@wicom.at Status: Open Old-Bug Type: Misbehaving function Bug Type: Sockets related Assigned To: Comments: reclassify Previous Comments: --------------------------------------------------------------------------- [2000-08-17 04:42:03] kh.wild@wicom.at I have to communicate with a perl daemon that gives me an hash when I connect the port. After that I have to complete the data with this hash an send it in the same connection back to the daemon. What I have todo is a fgets for the first string and after sending the comleted data with an fputs. The daemons never receive my data's after the fputs. I tried the newest snap to use the fflush. But this didn't solve the problem. --------------------------------------------------------------------------- [2000-08-16 14:10:33] derick@php.net that's a nice piece of code, but totally useless. COuld you clarify it bit more? --------------------------------------------------------------------------- [2000-08-16 14:02:57] kh.wild@wicom.at $fd = fsockopen( $server, $port, &$errno, &$errstr ); if( ! $fd ) { print( "Couldn't connect to $server, errno: $errno, errstr: $errstr<br>n" ); exit; } set_socket_blocking( $fd, false ); $ret = ''; while( ! feof( $fd ) ) { $ret .= fgets( $fd, 128 ); } if( trim( $ret ) <> '' ) { $key = strip_crlf( $ret ); } else { print( "Couldn't get key<br>n" ); exit; } print( "got key: ---$key---<br>n" ); $hash = md5( "$passwd.$key" ); $tmp = "$serviceid:$username:$hash"; fputs( $fd, "$tmpn", strlen( $tmp ) + 1 ); fflush( $fd ); $ret = ''; while( ! feof( $fd ) ) { $r = fgets( $fd, 128 ); print( "-" . $r . "-" ); $ret .= $r; } print( "received id: $ret<br>n" ); fclose( $fd ); --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=6200

« previous php.dev (#45362) next »