fwrite() not writing. Error with my code, or the remote client?

Posted by Rob on Stack Overflow See other posts from Stack Overflow or by Rob
Published on 2010-05-31T14:07:31Z Indexed on 2010/05/31 14:23 UTC
Read the original article Hit count: 137

Filed under:
|
|

Trying to set up a script to send commands to a remote client on a Win32 system. Here is the code:

$command = $_POST['command'];
$host = $_POST['host'];
$port = $_POST['port'];
$fp = @fsockopen($host, $port, $e, $s, 15);
if (!$fp) {
    echo 'Error! Here\'s your problem: ' . $e . ': ' . $s;
}else{
    $fw = fwrite($fp, $command);
        if (!$fw){
            echo 'Failed sending command.';
            fclose($fp);
        }else{
            fclose($fp);
            echo 'Successfully sent: ' . $command;
        }
}

My buddy is working on the remote client, and he says that this script is sending ''

However, my script is echoing Successfully sent: test

Am I doing something wrong, or is it a problem on his end?

© Stack Overflow or respective owner

Related posts about php

Related posts about tcp