ID: 6200
Updated by: sniper
Reported By: [EMAIL PROTECTED]
Status: Open
Old-Bug Type: Misbehaving function
Bug Type: Sockets related
Assigned To: 
Comments:

reclassify


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

[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, "$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


-- 
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