Skip to main content
gamedev.net
🔒 Locked 🤖 Godot

[web] PHP & Sockets

Started by VahnRPG Jun 23, 2006 at 10:11 PM 8 replies 1.8k views
Original Post
VahnRPG
VahnRPG
Greetings, all! Lately I've been working on a script that will allow me to telnet into a php script I've got running....however it only seems to work locally. I'm pretty sure it's programmed right...I use my local IP for the host for the socket connection since that's the only one it seems to bind to, but then external connections can't seem to log in. Just a simple
if (!@socket_bind($this->initFD, $this->domain, $this->port)) {
  $error = $this->getLastSocketError($this->initFd);
  @socket_close($this->initFD);
  $this->_sendDebugMessage("Could not bind socket to ".$this->domain." on port ".$this->port." (".$error.").");
}
I've tried running it on this computer, i've tried running it on my linux box, i've even tried at work. This computer can connect to itself and the linux box (cuz they're on the same network) and the computers at work can connect to it as well when run from there...however if I tried to get a friend to connect to it, he couldn't. Either with my local ip or my world ip, it doesn't work. Any ideas? Thank you!
tstrimp
tstrimp
First thing to check would be any type of firewall that might be blocking internet traffic. Some ISP even block certain ports at their switch to prevent you from using DSL/Cable internet for things like websites.
VahnRPG
VahnRPG
Well, I have my firewall and router set up to open the port I'm wanting, but when i try and telnet into my world IP it still doesn't connect :(
kanzler
kanzler
Is $this->domain perhaps set to a specific address like 127.0.0.1? Try calling socket_bind with address set to 0, this will make it bind to every address available:

socket_bind(resource socket, 0, int port)
VahnRPG
VahnRPG
whoo
i set my computer to dmz (thank god for my firewall) and then set the host ip to use in the script to 0 and it worked! :D
kanzler
kanzler
Binding to address 0 should work without setting your router to DMZ, which would probably be a lot safer too.
VahnRPG
VahnRPG
Hm...
Nope, needed to be in dmz mode for that to work :(
gamealot
gamealot
Check out my chat source for socket examples, http://projects.cyberlot.net/trac/flashunity/browser/main/trunk/includes/socket.class.php

[Edited by - gamealot on July 7, 2006 7:03:07 AM]
--------------------------------- PHP, HTML, DHTML, &#106avascript, Ajax, Flash.. Available for hire or partner on web based games.
VahnRPG
VahnRPG
Port forwarding did the trick! Thanks!! :D

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.