ID: 6200
Updated by: andy
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Closed
Bug Type: Sockets related
Operating System: Linux 2.2.14
PHP Version: 4.0.1pl2
New Comment:

Please upgrade to the latest version and try the script
again.  Re-open if problem still exists.

Previous Comments:
------------------------------------------------------------------------

[2001-01-30 05:00:48] [EMAIL PROTECTED]

reclassify


------------------------------------------------------------------------

[2000-08-17 04:42:03] [EMAIL PROTECTED]

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] [EMAIL PROTECTED]

that's a nice piece of code, but totally useless. COuld you clarify it bit more?

------------------------------------------------------------------------

[2000-08-16 14:02:57] [EMAIL PROTECTED]

$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 );


------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=6200&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to