Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've written a PHP websockets server based on this library: https://github.com/Flynsarmy/PHPWebSocket-Chat

This library operates as a server, and handles all incoming requests. The client can connect when I'm running locally (connecting to address 127.0.0.1:9300), but I'm unable to connect if my client is not on the machine running the server. I've tried turning off my firewall; is there another privilege I need to grant PHP in order for it to be able to receive and respond to websocket communication?

I'm running PHP5, Ubuntu Server 12.04 LTS, and connecting with Google Chrome (latest).

share|improve this question
1  
I've updated your other question for the same problem as well. –  Chida Aug 19 '12 at 19:57
add comment

3 Answers

up vote 2 down vote accepted
 From line 62 of https://github.com/Flynsarmy/PHPWebSocket-Chat/blob/master/server.php

// for other computers to connect, you will probably need to change // this to your LAN IP or external IP, // alternatively use: gethostbyaddr(gethostbyname($_SERVER['SERVER_NAME']))

$Server->wsStartServer('127.0.0.1', 9300);

change this line to,

 $Server->wsStartServer('0.0.0.0', 9300);

or the IP to your LAN IP and try.

share|improve this answer
    
MANY thanks. Not sure how I missed that. –  Nathan Friend Aug 19 '12 at 20:10
add comment

The file server.php contains the answer to your problem

// for other computers to connect, you will probably need to change this to your LAN IP or external IP,
// alternatively use: gethostbyaddr(gethostbyname($_SERVER['SERVER_NAME']))
$Server->wsStartServer('127.0.0.1', 9300);

Changing the last line to whatever the public facing IP address of your server s will probably fix your problem.

share|improve this answer
add comment

just edit the server.php; right now it listens on the loop-back only [ $Server->wsStartServer('127.0.0.1', 9300); ]. change it to listen to all ips [0.0.0.0?] or at least one ip assigned to the network interface [ eth0? ] of your server.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.