How do I send a message from a PHP-client to a C-server using a socket. I need simple code, one TCP-connection.
The client is written in PHP and the server in C on Windows.
How do I send a message from a PHP-client to a C-server using a socket. I need simple code, one TCP-connection.
The client is written in PHP and the server in C on Windows.
See at first example here.
$socket = socket_create(AF_UNIX, SOCK_DGRAM, 0); //AF_UNIX - it's important!
$socket_file = dirname(__FILE__) . '/socket_file.sock';
socket_bind($socket, $socket_file);
socket_recvfrom($socket, $some_buf, $input_buf_size, 0, $from);
socket_sendto($socket, $some_buf, $some_buf_len, 0, $from);