PHP Test results
| From: | noreply@php.net | Date: | Sun, 14 Apr 2002 20:41:09 +0000 |
| Subject: | PHP Test results | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-5084@lists.php.net to get a copy of this message | ||
array (
'user_name' => 'gilles',
'email' => 'gilles@devweb.nl',
'package' => '4.2.0-RC2',
'testcase' => '0',
'status' => 'Good',
'os' => 'Windows NT/2K',
'sapi' => 'Other',
'automake' => 'other',
'autoconf' => 'other',
'libtool' => 'other',
'bison' => 'other',
'sockets' => 'on',
'test' => '',
'problems' => 'just wondering,
i\'ve tried some socket programming with php and it never works right.
after making a socket listener i connect to the port with telnet and it quits right after receiving
the first character, so what happens here is that the program should wait for a newline as a
termination but it terminates after one char.
im running win2000 sp2 and apache 1.3.24
someone suggested trying a different telnet client, so i did, but with the same results....',
'bugids' => '',
'remarks' => 'this is my server code (from a devshed tutorial)
// set some variables
$host = \"192.168.0.8\";
$port = 1234;
// don\'t timeout!
set_time_limit(0);
// create socket
$socket = socket_create(AF_INET, SOCK_STREAM, 0) or die(\"Could not create socket\\n\");
// bind socket to port
$result = socket_bind($socket, $host, $port) or die(\"Could not bind to socket\\n\");
// start listening for connections
$result = socket_listen($socket, 3) or die(\"Could not set up socket listener\\n\");
// accept incoming connections
// spawn another socket to handle communication
$spawn = socket_accept($socket) or die(\"Could not accept incoming connection\\n\");
// read client input
$input = socket_read($spawn, 1024) or die(\"Could not read input\\n\");
// clean up input string
$input = trim($input);
// reverse client input and send back
$output = strrev($input) . \"\\n\";
socket_write($spawn, $output, strlen ($output)) or die(\"Could not write output\\n\");
// close sockets
socket_close($spawn);
socket_close($socket);',
)