com.unity.netcode.gameobjects icon indicating copy to clipboard operation
com.unity.netcode.gameobjects copied to clipboard

Bind to a specific ip address when starting the server (there are several of them on the server). How?

Open KOT-KOCMOCMOHABT opened this issue 3 years ago • 1 comments

maybe in public class UNetTransport : NetworkTransport

public string ServerBindAddress = "";

public override bool StartServer()
{
            var topology = new HostTopology(GetConfig(), MaxConnections);
            if (ServerBindAddress != "")
            {
                      UnityEngine.Networking.NetworkTransport.AddHost(topology, ServerListenPort, ServerBindAddress);
            }
            else
            {
                      UnityEngine.Networking.NetworkTransport.AddHost(topology, ServerListenPort, null);
            }
            return true;
}

or

create new method like:

public string ServerBindAddress = "";

public override bool StartServerAndBind()
{
            var topology = new HostTopology(GetConfig(), MaxConnections);
            {
                      UnityEngine.Networking.NetworkTransport.AddHost(topology, ServerListenPort, ServerBindAddress);
            }
            return true;
}

Or is there another way?

KOT-KOCMOCMOHABT avatar Mar 21 '22 11:03 KOT-KOCMOCMOHABT

it will be very helfull!

7Upers avatar Mar 21 '22 11:03 7Upers