I am in the process of building a chat application in PHP using Web Sockets. I started with the code phpwebsocket project and here. The code works fine on my local machine but when i try it on my site (does not have a dedicated IP) it has a problem establishing the web socket connection. I tried it with all possible combinations for socket binding (site addres, external ip addr, local ip addr) but failed.
Asked
Active
Viewed 1,083 times
3
-
2I have a suspicion this is a networking problem rather than programming related. Have you tried basic connectivity tests? Are you trying to go through a firewall? – SpliFF Apr 30 '11 at 04:34
-
I have disabled my firewall. Also when i try running the socket server from another pc in my LAN and connect to using local IP addr it works fine. – Nithin Apr 30 '11 at 04:43
-
What happens if you try to telnet to the port number on the server for the site? Do you have shell access to the server? – Phil Lello Apr 30 '11 at 05:14
-
No I am not able to telnet to mysite on the port i have specified for binding web socket. yea i have shell access, that s how i running the php websocket script on the server. – Nithin Apr 30 '11 at 16:25
1 Answers
2
You must be able to connect to the port on the server where the WebSocket server is running. If you are using a port other than 80 or 443 on your site for the WebSocket server, then you probably need to configure (or ask) the site to accept incoming connections on that port (because they may deny it by default for security reasons). It you are unable to telnet to the WebSocket port on the server, then this is likely the case (or phpwebsocket is not in fact correctly configured to list on that port).

kanaka
- 70,845
- 23
- 144
- 140