How to connect to a server externally

Options
hmehta410
edited May 2013 in Photon Server
This is really beginner question but how can I connect to a self hosted server? I've just started using photon and have done the hello world tutorials and looked at the demos a little bit and can connect to the server locally but I don't know how to do it from a separate computer. Are there any tutorials that explain it fairly in-depth that I missed? Most seem to skate over the subject like I should know how already. I'm just trying to get the chat room demo to run on a different computer for now.

Lets say I set the game server IP config in the photon control to autodetect public IP, what IP do I set the clients to connect to and what configurations would I need to change and anything else that I don't even know about. If someone could at least point me in the right direction I would be very grateful.

Comments

  • [Deleted User]
    Options
    Hello,

    there are 3 options (basically):

    - use the "localhost" IP (127.0.0.1): Photon will only be accessible on your local machine
    - use an IP of your private network (e.g., 192.168.x.x): Photon will be accessible from within your private network, like your office network
    - use a public IP or auto-detected public IP: This is the IP of your router that is "visible" to the internet. E.g., all of the computers in your office network share the same public IP. This option is best suited for dedicated servers with an own public IP.

    In most cases, one of these options should be fine.

    There is one "special case":
    If you have Photon running on a computer in your private network (without a dedicated public IP), AND you want to access it from outside your network (through the internet), you need to assign the auto-detected public IP and configure port-forwarding on your router. Google will help you to figure it out for your router. ;) The list of used ports can be found here: http://doc.exitgames.com/photon-server/Requirements/
  • Thank you! After reading about port forwarding and NAT and stuff things are making a lot more sense. I'm probably gonna be on here asking a lot of these really beginner networking questions :D.

    **EDIT**
    Ah sorry another basic question probably but what would I type into x.x.x.x part of peer.connect("x.x.x.x:5055","application name") for autodetect public ip.

    do have to buy a domain name like (www.whatevermynameis.com) and set up some dynamic dns thing in my router?

    Or see if my isp will provide me a static ip address for free? Are there any other options?

    Thanks
  • [Deleted User]
    Options
    Do have to buy a domain name like (http://www.whatevermynameis.com) and set up some dynamic dns thing in my router?

    Or see if my isp will provide me a static ip address for free? Are there any other options?

    If you want an IP that does not change: You need one of both, yes.

    If you are only using this for "testing purposes": you can look up your public IP on a service like http://whatismyip.com and set that IP in your clients. (But be aware that the IP might change.)

    It might also be an option to rent a small virtual private server (VPS), which comes with a static IP and usually only requires that you open the required firewall ports - no other network configuration stuff required.
  • yeah i'll probably just stick to testing with the non-static (dynamic?) public ip. So are these the steps you need to setup access from outside your network?

    1. check the firewall settings
    if worst comes to worst you can just turn it off to check if the problem is here or somewhere else

    2. use port forwarding (only with router?)
    portforward.com is pretty good for help.
    If ports aren't open you can try and factory reset your router and try again(worked for someone else)
    It seems certain antivirus' got in the way of the ports too so you can disable them to test

    3. change the game server ip config in photon control (need a website domain name and setup ddns in router to use auto-detect public ip)
    some isp give free static public IPs or there cheap domain names if you look online

    4. change the client code peer.connect() to address the public ip or domain name
    ("xxx.xxx.xxx.xxx:5055","lite") or ("mydomainname.com:5055","lite")

    are there any steps I'm missing like config file i need to edit or am I totally wrong somewhere? any other tips?

    I was looking into port forwarding and it basically identifies which ports to send data to. But it is only for routers. Is there an equivalent for a wired connection? Or what? I was checking if the ports are open after port forwarding and they were still closed. So I decided to give Ethernet cable a try and the ports are closed there as well. How would i get it to work over a wired connection?
  • [Deleted User]
    Options
    Your steps sound correct.
    You also need to set the Photon Gameserver IPs to "Autodetect Public IP", but I guess you have done that.

    I don't understand the part with the "wired connection". What do you mean? How did you check the ports?
    You need a service that is listening on the port - make sure Photon is running...
  • Thanks I've got the demos to work from a public ip now and nevermind about the other stuff I was being stupid :D
  • falonso
    Options
    How were you able to fix your issue? I'm dealing with the same issue (trying to connect to a local server that is set to auto-detect public IP).