note 44887 rejected from function.socket-read by aidan

From: Date: Thu, 19 Aug 2004 10:05:31 +0000
Subject: note 44887 rejected from function.socket-read by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-74931@lists.php.net to get a copy of this message
Note Submitter: jonny2030cn at hotmail dot com ---- 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!

« previous php.notes (#74931) next »