note 44887 added to function.socket-read
| From: | jonny2030cn at hotmail dot com | Date: | Thu, 19 Aug 2004 09:41:27 +0000 |
| Subject: | note 44887 added to function.socket-read | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-74929@lists.php.net to get a copy of this message | ||
why i cant get the reply ?
Here's the code!
How can i get the return by 'socket_read()"?
<?
/*get the post "01 booklist select * from contentlist"*/
$sql = "select * from music";
error_reporting(E_ALL);
/* Get the port for the WWW service. */
$service_port = 5000;
/* Get the IP address for the target host. */
$address = '192.168.0.142';
/* Create a TCP/IP socket. */
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket < 0) {
echo "socket_create() failed: reason: " . socket_strerror($socket) . "\n";
} else {
echo "\n";
}
$result = socket_connect($socket, $address, $service_port);
if ($result < 0) {
echo "socket_connect() failed.\nReason: ($result) " . socket_strerror($result) .
"\n";
} else {
echo "\n";
}
//$out = '';
socket_write($socket, $sql, strlen($sql));
while ($out = socket_read($socket, 0, PHP_BINARY_READ)) {
echo "right";
}
socket_close($socket);
?>
After change the 0 to 1024 in socket-read() is not work !
pls!
----
Manual Page -- http://www.php.net/manual/en/function.socket-read.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44887
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44887&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44887&report=yes
Search -- http://master.php.net/manage/user-notes.php