Page 1 of 1

Connecting via a socket to an IpServer

Posted: Fri May 02, 2008 3:37 pm
by rtcary
I am trying to get data via a socket from an IpServer (using Turbopowers IpServer library). I am able to make a connection and send data to the server, but I am not sure how to get data back. The fgets() just hangs (the server has sent the data with a putstring() ).

This is the test code:

$fp = $socket->open_fp("192.168.0.21", "");
if ($fp) {
echo "Socket has been opened: " . $fp . " " . date("m/d/y h:n:s", time()) . "<br>";
//fwrite($fp, "Please send me a report!");
echo fgets($fp) . "<br>";
fclose($fp);
} else {
echo "Socket cannot open socket<br>";
}

Any suggestions would be greatly appreciated...

Todd