An issue about connecting to gameserver in self host server

I do my port forwarding like this:
A:57195 --> master server)
B:60135 --> game server)
and my public ip is C.
My pun setting is to connect A:57195,so I can connect to my masterserver,but after that what should I do.As I know,the matser server should tell the client where the gameserver is(B:60135).If I set the Game Server Ip config in PhotonControl to public ip(which is C),I can't connect to the game server.So I should connect to B:60135 to enter my gameserver,right?If I should change my loadbalancing.dll?How?Any advice is appreaciated.Thanks in advance.


  • A and B are domains
  • hi, @kidd5368

    it is not really clear what configuration you have. let me assume. your game server and master are on same machine. and you have a router in front of it. if this is true, then your router should have public ip 'C'. and when someone connects to C:57195 he should be forwarded to master when to B:60135 then he should be forwarded to game server. in loadbalancing.dll.config there is setting for GameServer - 'PublicIPAddress'. it should be 'C'

  • Thanks for reply.Acutually,I don't have authority of my router(public ip).So I have to use the domains(A,B are domain names) to do the port forwarding.In this situation,how can I selfhost the server?
  • hi, @kidd5368

    if you were able to connect with A:xxxx to photon, then you should be able to connect directly to B:xxxx. if this works, then you need to modify config of GameServer


    set your domain here. then you should modify 'src-server\Loadbalancing\LoadBalancing\MasterServer\Lobby\GameState.cs' method GetServerAddress so, that it returns host name instead of public ip address.

    i assume it will work for you then.

    About Public Ip you see in PhotonControl. it can be wrong if you behind routers. because sites which detect your public ip can not know about NATs used in your network. i would say that if you have A and B then they should be attached to some IP address. and this address should be used as public ip. You should set it directly in LoadBalancing.dll.config as i wrote in previous answer. probably then it will work without modifications to code

Sign In or Register to comment.