zellfaze Posted January 1, 2009 Share Posted January 1, 2009 First let me introduce myself, I am Zell and I am a fairly fequent person on the phpfreaks IRC channel on Freenode. That is where it was suggested that I come here. I am working on building a MUD server in PHP, and I have the main server application written. I am just having a few problems with the socket stuff. My sockets will not bind to anything other than 127.0.1.1. When I run my server I get the output. web@Zinka-lnx:/media/VPC/public_html/test/mud$ sudo php server.php Warning: socket_bind(): unable to bind address [99]: Cannot assign requested address in /media/VPC/public_html/test/mud/server.php on line 16 Could not bind to address Cannot assign requested address web@Zinka-lnx:/media/VPC/public_html/test/mud$ Line 16 has on it. socket_bind($sock, $address, $port) or die("Could not bind to address\n" . socket_strerror(socket_last_error($sock)) ."\n"); The server starts up and works just fine if $address is set to 127.0.0.1 but if I set it to my public IP address it generates that error. I just got into socket programming a few days ago, so I really don't know where to go from here... Link to comment https://forums.phpfreaks.com/topic/139061-so-i-am-making-a-php-based-server/ Share on other sites More sharing options...
revraz Posted January 1, 2009 Share Posted January 1, 2009 What IP is set on your PC? Is your public IP on your router or is it actually assigned to your PC? Link to comment https://forums.phpfreaks.com/topic/139061-so-i-am-making-a-php-based-server/#findComment-727449 Share on other sites More sharing options...
zellfaze Posted January 1, 2009 Author Share Posted January 1, 2009 I am behind a wireless router, all the ports are forwarded to me. The IP address I am trying to use is the IP address our ISP assigned to us, not the one the router assigned to me. If you need said IP address do a lookup on zellfaze.crabdance.com I would rather not post the IP address, but the domain that points here should be fine. Link to comment https://forums.phpfreaks.com/topic/139061-so-i-am-making-a-php-based-server/#findComment-727578 Share on other sites More sharing options...
revraz Posted January 1, 2009 Share Posted January 1, 2009 My point was I believe the IP you need to use has to be assigned actually to the NIC, not to the Router. So it will probably work fine with localhost (127.0.0.1) or your internal IP (192.168.1.x) but not your External IP set to your Router. That is just my thoughts on why it won't bind. Don't you want it to bind to the local IP, and let the Port Forwarding on the router do it's work? Link to comment https://forums.phpfreaks.com/topic/139061-so-i-am-making-a-php-based-server/#findComment-727602 Share on other sites More sharing options...
zellfaze Posted January 1, 2009 Author Share Posted January 1, 2009 I will try the internal IP address and see if that works. Yup that works, it binds and people outside the LAN can indeed connect to it. Thank you Link to comment https://forums.phpfreaks.com/topic/139061-so-i-am-making-a-php-based-server/#findComment-727624 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.