php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6200 fputs doesn't send, do not fflush after fgets.
Submitted: 2000-08-16 14:02 UTC Modified: 2001-07-21 21:54 UTC
From: kh dot wild at wicom dot at Assigned:
Status: Closed Package: Sockets related
PHP Version: 4.0.1pl2 OS: Linux 2.2.14
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kh dot wild at wicom dot at
New email:
PHP Version: OS:

 

 [2000-08-16 14:02 UTC] kh dot wild at wicom dot 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, "$tmp\n", 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 );

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-16 14:10 UTC] derick@php.net
that's a nice piece of code, but totally useless. COuld you clarify it bit more?
 [2000-08-17 04:42 UTC] kh dot wild at wicom dot 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.

 [2001-01-30 05:00 UTC] sniper@php.net
reclassify

 [2001-07-21 21:54 UTC] andy@php.net
Please upgrade to the latest version and try the script
again.  Re-open if problem still exists.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC