facebook/hiphop-php — Issue #426: socket_read() - PHP_NORMAL_READ not works
Author: louisehu
Created: 2011-11-01 14:19:23+00:00
State: open

My test server listening on port 20099 at localhost, and send following text to connected clients: "Dolly".

Following code try to connect to test server, but unable to do it with hphp compiled binary. Same code works with PHP and hphp interpreters.

$socket=socket_create(AF_INET, SOCK_STREAM, SOL_TCP);

if($socket) {
$ret = socket_connect($socket, "127.0.0.1", "20099");
if($ret){
$data = socket_read($socket, 8192, PHP_NORMAL_READ);
echo $data."\n";
}
socket_close($socket);
}

HipHop message:

HipHop Warning: unable to read from socket [2]: No such file or directory in test_socket.php on line 6

Traced function calls of hphp compiled code:

[pid 12591] connect(26, {sa_family=AF_INET, sin_port=htons(20099), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
[pid 12591] fcntl(26, F_GETFL) = 0x2 (flags O_RDWR)
[pid 12591] recvfrom(26, "D", 1, 0, NULL, NULL) = 1