Hi all!
While following this guide: How to run a game server using LocalMultiplayerAgent in Container mode, I seem to run in to the issue where I can't connect to my dockerized game server.
When running the server in docker via the LocalMultiplayerAgent.exe all seems to work just fine. I'm getting heartbeats and the game server becomes "Active".
Now I'm supposed to test the connection to the game server by parsing "http://127.0.0.1:56100/Hello" in my browser. But I'm running into a "ERR_CONNECTION_TIMED_OUT" when trying to do so.
Also when disabling all my security measures, like firewalls and virusscanners, I can't connect to the container.
I'm saying I can't connect to the container because even when pressing the "Open in Browser" button in docker itself will give me a "ERR_CONNECTION_TIMED_OUT" response.
Can anyone tell me if they ran into a similar issue? Or pointers as to how this might be fixed?
This is the port config of the container:
Cheers!
Apparently copy-pasting images will show them while drafting, but will get lost once posting XD.
This is the port config image:
Answer by Dimitris Gkanatsios · May 27 at 05:40 PM
@itsjustnils in which port are you initializing your server? When using process mode, you need to grab the port using the GSDK -> MpsSamples/AgentListener.cs at main PlayFab/MpsSamples (github.com)
(that's a best practice for using containers as well)
Hi Dimitri,
That's exactly what I've been doing. I'm getting back the "game_port". I'm letting my server listen to the "game_port" - "ServerListeningPort".
What I noticed is that both the "ClientConnection" as well as the "ServerListening" ports are mapped to the same port (30000). But I guess this is expected when working with a process-based build?
Then on client side I request a game server and get the "game_port" there as well.
Here's two more screenshots from some logs of my server (as I'm allowed to only upload 2 per comment).
Both "ClientConnection" and "ServerListening" ports are mapped at 30000:
Server is listening on port 30000:
I've also tried to set up a container build again, these are the ports:
Server is listening to the "ServerListeningPort"
Connecting to the server should then be done via port 30000, but still no such luck (also tried connecting via port 7777 to be sure).
I'm starting to feel at a loss here.
Had no problems getting a server up and running with GameLift. I'm still considering PlayFab because of it's (supposed) ease of use compared to Amazon.
And I'm still not able to connect to my server locally if it's run as a container, getting the error "An existing connection was forcibly closed by the remote host" if I try.
Apologies for spam, but I'm using this to share as much findings as possible. Seems I'm getting a
SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
error now
I'm guessing this means the server is unable to respond? Firewall maybe?
Today I've ripped out DarkRift2 and replaced it with Mirror for Unity. I'm getting the exact same results. I can't find what I'm doing wrong and this is what ends my efforts in terms of trying to use PlayFab for our product. Cheers.
Answer by Gosen Gao · May 20 at 08:57 AM
Have you tested your server directly without the LocalMultiplayerAgent, and what is the excepted result for the HTTP request “http://127.0.0.1:56100/Hello”? According to the image you post, container port 30000 is mapped to local 56100. Please make sure your server is listening to port 30000/tcp, you can check the port states by entering into this docker container.
The expected result for "http://127.0.0.1:56100/Hello" would be something more than a timeout. I'm not sure what to expect other than the tutorial telling me I should use it to test if everything is set up correctly.
My server is indeed listening to port 30000. When trying to connect locally without any PlayFab "interference" (running both server and client in unity editor, no playfab tools used) on 127.0.0.1:30000 everything is working as expected.
The /Hello endpoint is specific for the wrapper game sample we have posted on GitHub. What is the Unity project you are using? If this doesn't expose a web server, it makes sense that you are not seeing results from querying the /Hello endpoint.
This is the wrapper sample that should be used with the tutorial MpsSamples/wrappingGsdk at main PlayFab/MpsSamples (github.com)
Answer by itsjustnils · May 21 at 01:23 PM
I've tried everything withing my knowledge and a lot of things I found on the internet what might solve my problem. Please be aware that this isn't my first ever mutliplayer project I'm working on, but it is my first ever PlayFab integration I've been looking in to for over a week now.
Ended up using GameLift's integration instead, I had no problem getting my own custom server migrated to it's requirements and managed to get everything up and running (both connecting locally as connecting to my deployed gameplay server) within a day.
I think you should look at what GameLift is doing well and try to learn from it, both on documentation- as well as tech workflow level.
Thanks for your support tho.
Cheers!
So many typos and I can't seem to find the "edit" button XD
Answer by Dimitris Gkanatsios · May 30 at 07:26 PM
I'm sorry you're having issues. On process mode, the ServerListeningPort should be the same as the ClientConnectionPort.
It might be a firewall issue, not sure. Have you checked the Mirror sample here? MpsSamples/UnityMirror at main PlayFab/MpsSamples (github.com)
Is the server process open when you try to connect? When you run it with LocalMultiplayerAgent, it transitions the game server from StandingBy state to Active, after which it stays alive for a number of seconds, configurable in the settings JSON file.
To be clear, the LocalMultiplayerAgent in process mode works perfectly for me. Once I deploy the build in process mode, I'm not able to connect.
I've had another spin with the sample project you mentioned. LocalMultiplayerAgent-wise everything works out just fine.
When I deploy this server build (after making sure it runs automatically instead of having to press the "Server" button), I request a server to retrieve it's ip and port number, and again I'm unable to connect.
Is it possible one can only connect through another flow? Like using matchmaking (something I don't need for my specific project)?
When did you do a hotfix XD. Now I can just connect with the same flow I've been trying the past 2 weeks!
Glad that it's working for you. We didn't do any release today or yesterday, not sure what was going wrong. But to your question, if everything works great, you should be able to connect to the server with the values you get from the RequestMultiplayerServer API call. Matchmaking is *not* required.
Thanks. Yes I'm still not sure why connecting to the server failed before. I've been working with several networking and hosting apis over the past weeks. Maybe I simply missed something because of it.