Cannot Connect to Local Playfab Server

Please if anyone can help me with this I would be very grateful. I am at a loss about what I am doing wrong which prevents me from connecting my client Unity build to my local Playfab server.
For context, I am running a Linux dedicated server Unity build in a docker Linux container. I am trying to use Playfab for my server hosting, but before that I am utilizing their local multiplayer agent in order to debug my game locally. I believe the Playfab server is starting up correctly as it debugs that the server is in the active state.

This is being debugged in the Docker container log after server startup:

publicIpV4Address: 127.0.0.1
Environment: LOCAL"```

**In my scripts on the server side, I create the server world:**

```csharp
Debug.Log("SERVER WORLD CREATED");
server = ClientServerBootstrap.CreateServerWorld("ServerWorld");
World.DefaultGameObjectInjectionWorld ??= server;

and then I tell the server to listen on the proper port:

var drvQuery = World.DefaultGameObjectInjectionWorld.EntityManager.CreateEntityQuery(ComponentType.ReadWrite<NetworkStreamDriver>());
drvQuery.GetSingletonRW<NetworkStreamDriver>().ValueRW.Listen(NetworkEndpoint.AnyIpv4.WithPort((ushort)ServerStartup.Instance.Port));
Debug.Log($"Server networkStreamDriver is listening on: {NetworkEndpoint.AnyIpv4.WithPort((ushort)ServerStartup.Instance.Port)}");
drvQuery.Dispose();

On the client side I create the client world:

Debug.Log("cLIENT WORLD CREATED");
client = ClientServerBootstrap.CreateClientWorld("ClientWorld");
World.DefaultGameObjectInjectionWorld ??= client;

Then I tell the client to connect to the server, this is done after the Docker logs have told me the server is active and listening on the proper port:

var endpoint = NetworkEndpoint.LoopbackIpv4.WithPort(7778);
var drvQuery = World.DefaultGameObjectInjectionWorld.EntityManager.CreateEntityQuery(ComponentType.ReadWrite<NetworkStreamDriver>());
connectionEnt = drvQuery.GetSingletonRW<NetworkStreamDriver>().ValueRW.Connect(World.DefaultGameObjectInjectionWorld.EntityManager, endpoint);
m_Stream = drvQuery.GetSingletonRW<NetworkStreamDriver>().ValueRW;
drvQuery.Dispose();

This is the debug I have in the client update loop:

Debug.Log($"Client update loop: is client connected? {m_Stream.GetConnectionState(World.DefaultGameObjectInjectionWorld.EntityManager.GetComponentData<NetworkStreamConnection>(connectionEnt))}");

This debug only ever says “Connecting”. For some reason, I get no error in this connection process, it just never changed from the “Connecting” state. Am I missing a step here? I am not doing anything with NetworkDriverStores or NetworkDrivers, should I be? I am also not yet calling

networkDriver.ScheduleUpdate().Complete();

Because I am only trying to establish an initial connection. Could that be giving me trouble? Another thing is that both my Server and Client builds exist in the same Unity project, I just have separate scenes for the Server and the Client which are the only scenes included in their respective builds. Will this cause any issues?

A debug I am getting is

"Create client default socket network interface driver"

I am not sure what this means exactly, any insights?

I have been trying for 2 weeks to get this client to connect to my local server to no avail. What I have posted is the only code in my project relating to Netcode for Entities, so if I am missing a crucial step please let me know, thank you!!

Hey! Apologies for the delay.

  • Replace World.DefaultGameObjectInjectionWorld.EntityManager with client.EntityManager.
  • Other than that, this looks correct.

This implies that the UDP Unity Transport connect payloads are never arriving on the server. Can you check with wireshark? It could be that docker is failing to forward those packets, or that your cloud is firewall blocking those packets. Can you successfully ping your server machine?

No, you shouldn’t need to call any manual driver related flows to get this to work. NetworkStreamReceiveSystem (a netcode package system) handles all that for you. Calling connect should be sufficient (and you’re already doing that).

No, this is fine too.

Can you connect to your client world to your server world in the editor? Via the PlayMode tools “Client & Server” dropdown option?

This is just a log saying that netcode has created* (typo) the client default socket network interface driver. Perfectly normal. You can find it here: DefaultDriverConstructor.cs:259.