question

itsjustnils avatar image
itsjustnils asked

LocalMultiplayerAgent Docker unable to connect (even with all firewalls and virusscanners disabled)

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!

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.

itsjustnils avatar image itsjustnils commented ·

Apparently copy-pasting images will show them while drafting, but will get lost once posting XD.

This is the port config image:

0 Likes 0 ·
1.jpg (4.7 KiB)
Dimitris-Ilias Gkanatsios avatar image
Dimitris-Ilias Gkanatsios answered

@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)

5 comments
10 |1200

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

itsjustnils avatar image itsjustnils commented ·

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.



0 Likes 0 ·
itsjustnils avatar image itsjustnils commented ·

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:

0 Likes 0 ·
serverports.jpg (43.5 KiB)
itsjustnils avatar image itsjustnils commented ·

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.

0 Likes 0 ·
ports.jpg (55.0 KiB)
server.jpg (12.8 KiB)
itsjustnils avatar image itsjustnils commented ·

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?

0 Likes 0 ·
itsjustnils avatar image itsjustnils commented ·

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.

0 Likes 0 ·
Gosen Gao avatar image
Gosen Gao answered

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.

4 comments
10 |1200

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

itsjustnils avatar image itsjustnils commented ·

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.

0 Likes 0 ·
Dimitris-Ilias Gkanatsios avatar image Dimitris-Ilias Gkanatsios itsjustnils commented ·

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.

0 Likes 0 ·
Dimitris-Ilias Gkanatsios avatar image Dimitris-Ilias Gkanatsios Dimitris-Ilias Gkanatsios commented ·

This is the wrapper sample that should be used with the tutorial MpsSamples/wrappingGsdk at main PlayFab/MpsSamples (github.com)

0 Likes 0 ·
Show more comments
itsjustnils avatar image
itsjustnils answered

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!

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.

itsjustnils avatar image itsjustnils commented ·

So many typos and I can't seem to find the "edit" button XD

0 Likes 0 ·
Dimitris-Ilias Gkanatsios avatar image
Dimitris-Ilias Gkanatsios answered

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.

5 comments
10 |1200

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

itsjustnils avatar image itsjustnils commented ·

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.

0 Likes 0 ·
itsjustnils avatar image itsjustnils commented ·

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)?

0 Likes 0 ·
itsjustnils avatar image itsjustnils commented ·

When did you do a hotfix XD. Now I can just connect with the same flow I've been trying the past 2 weeks!

0 Likes 0 ·
Dimitris-Ilias Gkanatsios avatar image Dimitris-Ilias Gkanatsios itsjustnils commented ·

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.

0 Likes 0 ·
itsjustnils avatar image itsjustnils Dimitris-Ilias Gkanatsios commented ·

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.

1 Like 1 ·

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.