peter279k / phpwebsocket

Automatically exported from code.google.com/p/phpwebsocket
0 stars 0 forks source link

Post message from a standalone php file #38

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I have the following php file:

<?php
    $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
    socket_connect($sock, '127.0.0.1', 12345);

    $msg = 'hi';
    $len = strlen($msg);

    socket_sendto($sock, $msg, $len, 0, '127.0.0.1', 12345);
    socket_close($sock);
?>

I set the up and it works, but I want to send a message from the above PHP file 
to the server, can this be done? When I do, I get the following error: 

PHP Warning:  socket_select(): 5 is not a valid Socket resource in 
/Desktop/phpwebsocket-read-only/server.php on line 18

Can somebody help? Thanks

Original issue reported on code.google.com by mich...@online-bouwmaterialen.nl on 1 Sep 2011 at 1:14

GoogleCodeExporter commented 9 years ago
The server expects an opening handshake. Basically you need to make a PHP 
WebSocket client.

Below the specifications you will need:

http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76#page-7

I did make one myself, but rewrote the server as well to use the latest draft. 
You can download that one but its not compatible with phpwebsocket.  

The latest specification for reference: 
http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-13

Original comment by ch...@devristo.com on 1 Sep 2011 at 5:40