note 22338 rejected from function.socket-read by didou

From: Date: Wed, 15 Oct 2003 11:59:02 +0000
Subject: note 22338 rejected from function.socket-read by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-58628@lists.php.net to get a copy of this message
Note Submitter: graham@halodev.com ---- I set out to create a simple echo test application thingy in win2k running 4.1.2 $socket = socket_create( AF_INET , SOCK_STREAM , SOL_TCP); $isbind = socket_bind($socket, "127.0.0.1", 7878); if (!($isbind)){ echo "Trouble Binding"; return 0; } socket_listen($socket, 10); while(true){ $newsock = socket_accept($socket); if ($newsock){ echo "socket connected...\n"; socket_write($newsock, "ECHO>"); $indata = socket_read($newsock, 512); echo "$indata"; socket_write($newsock, "\n" . $indata . "\n LATER!"); echo "success"; socket_close($newsock); socket_close($socket); return 0; } else{ echo "screwed up\n"; return 0; } } echo "done\n"; } I attempted to get it to read a string (up to 512 chars) and then simply echo it. What it does is grab one char, repeat it and quit. Any ideas on what I'm doing wrong?

« previous php.notes (#58628) next »