+2  A: 

Change this line

$conn_ip = "127.0.0.1"; // probably localhost

to

$conn_ip = 0;


  • 127.0.0.1 means that your "webserver" will only listen for connections only on 127.0.0.1 (localhost)
  • 0 means that your "webserver" will listen on each and every IP of your computer
Kalmi
Tried that as well, same problem. :(
um... firewall?
Kalmi
No firewall, in router DMZ
Tried 0, no change.
Try connecting to it from the same machine using the machine's ip. (for example http://192.168.0.2 ) Does that work?
Kalmi
Yes, the machine IP is working.
Perhaps only other machines can access it by my IP?
Than it is a firewall problem. What OS?
Kalmi
Win7. Firewall is disabled.
Can other machines on the same access it by IP? If they can, than you should start looking at your router. (um... DMZ never worked for me... I always ended up using port forwarding... :p)
Kalmi
I have fixed it. I thought being in the DMZ would be enough but I had to change some router settings. So sorry for wasting everybody's time.
Would you mind marking my answer as a solution, since I pointed you in the right direction. (And you need to change that line anyways :)
Kalmi
A: 

Change your socket bind to:

socket_bind ($server, 0,$conn_port);

By specifying a $conn_ip, you are only binding to that interface. In this case, you are binding to the loopback. This is the default for testing, as you may not want to allow the world to connect to your service when you first start writing it.

brianegge
There is no apparent change when I swap $conn_ip with a 0.