Search Unity

Unable to Connect to Server on LAN

Discussion in 'Multiplayer' started by BenjaminAlbrecht, Aug 5, 2019.

  1. BenjaminAlbrecht

    BenjaminAlbrecht

    Joined:
    Apr 27, 2019
    Posts:
    4
    I built a multiplayer game using the UNET Transport Layer API. Everything works correctly if I run the server and client on the same machine (ip 127.0.0.1, port 26000).

    When I attempt to run the client on another machine (same network), the client is not able to connect to the server. I don't get an error message, the connection just times out.

    Because everything appears to work correctly when running on the same machine, I think the issue has something to do with my network, firewall, Unity settings, or ip / port configuration rather than an issue with the code itself.

    Details:
    • Both machines are running Windows 10
    • The server and client are running in the Unity editor (2019.1.0)
    • The client is attempting to connect to the IPv4 of the server machine (192.168.1.87) on port 26000.
    • The Unity editor is allowed through Windows Defender Firewall on both machines
    Initialize Server
    Code (csharp):
    1. hostId = NetworkTransport.AddHost(hostTopology, port, serverIP);
    2. NetworkTransport.Init();
    3. hostTopology = new HostTopology(connectionConfig, maxUsers);
    Initialize Client
    Code (csharp):
    1. hostId = NetworkTransport.AddHost(hostTopology, port, serverIP);
    2. NetworkTransport.Init();
    3. hostId = NetworkTransport.AddHost(hostTopology, 0);
    4. clientId = NetworkTransport.Connect(hostId, serverIP, port, 0, out error);
     
  2. MrsPiggy

    MrsPiggy

    Joined:
    Jun 13, 2018
    Posts:
    154
    Is the private address of the server machine really bound? In other words is the server listening on 192.168. etc.. or just 127?
     
    Joe-Censored likes this.