Code:
$str = "example";
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($socket, "127.0.0.1", "2107");
socket_listen($socket);
socket_write($socket, $str, strlen($str));
$resp = socket_read($socket, strlen($str), PHP_READ_NORMAL);
echo $resp;
Without socket_read it works perfect and i get the $str value in my console application as output (response from console application is then success). But so far i add socket_read the script is just loading and hanging up. And also i does not see the $str value in the console application although this should be done (with socket_write) before the socket is listining to the response. There is then just the notify in my console application that a connection has been established but it hanging up - without stream_read -> perfect.
Any ideas?