question

panagiotistitonis avatar image
panagiotistitonis asked

Get internet facing port of game server (Unity)

Ports defined on build ex. game_port ~ 7777 ~ UDP are mapped to an internet facing port when deployed (ex. 30000).

My question is, is it possible to get that port number inside game server instance (Unity server)?

PlayFabMultiplayerAgentAPI.GetConfigSettings()["game_port"] will return 7777 while clients on Get Match result will get game_port ~ 30000.

Why I need this is. Using Photon Fusion with Playfab game server/ Match Making, to speed server deployment and client connect time want to initialize Photon (with unique name) before server is set to ReadyForPlayer (no match id is assigned yet to server in this stage) which can cut down 3-5secs or maybe even more.

Thus need a unique identifier for each server that is accessible to client through GetMatch result that client gets from MatchMaking. Best case senario would be to have access to ServerID on clients but seems that data are not passed through GetMatch result.

Would appreciate any insight on how to get either public facing port on server or Server ID on client.

unity3dphotonCustom Game ServersMatchmaking
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Dimitris Gkanatsios avatar image
Dimitris Gkanatsios answered

Γεια χαρά Παναγιώτη!

PlayFabMultiplayerAgentAPI.GetGameServerConnectionInfo should give you all the info you need.

https://github.com/PlayFab/gsdk/blob/ca26f5be14ff9c3efb8e3f37eaee1fd043fa952d/UnityGsdk/Assets/PlayFabSdk/MultiplayerAgent/PlayFabMultiplayerAgentAPI.cs#L155

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

panagiotistitonis avatar image panagiotistitonis commented ·

Ευχαριστώ! Beats me how i missed that, thanks again!

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.