Has anyone had any experience with stream oriented unix domain sockets and PHP?
I've written a server in C++ that sends data to the socket. I've also written a C++ client that reads and displays the data.
However, when I try to write a PHP4 client, the connect() fails with "Invalid argument". See the code below.
<?
$handle = socket( AF_UNIX, SOCK_STREAM, 0 );
if ( $handle < 0 )
{
print "Error: socket: " . strerror( $handle ) . "\n";
exit();
}
$result = connect( $handle, "/tmp/socket" );
if ( $result != 0 )
{
print "Error: connect: " . strerror( $result ) . "\n";
exit();
}
?>
Running the above code results in:
Error: connect: Invalid argument.
Am I missing something?