NetworkTransport.AddHost() always returns 0

For some reason it always returns 0. No matter if I try to specify it with a specific port, or a random port. How can I get it to return a valid port?

	gc = new GlobalConfig();
	gc.ReactorModel = ReactorModel.FixRateReactor;
	gc.ThreadAwakeTimeout = 10;
    cc = new ConnectionConfig();
	channelRPC = cc.AddChannel(QosType.ReliableSequenced);
	channelStateUpdateUnimportant = cc.AddChannel(QosType.Unreliable);
	channelStateUpdateImportant = cc.AddChannel(QosType.ReliableSequenced);
	ht = new HostTopology(cc, maxConnections);
	NetworkTransport.Init(gc);

    localSocket = NetworkTransport.AddHost(ht, port);

Im not sure how much more information there is that I can give. I’m working on a LLAPI networking system thats already 2k lines plus. I took a little break from the project but started back up again and I believe it stopped working with a unity update. I don’t think it always returned 0. Before the update it was OK. I cant be 100% sure, though. I don’t think any more of my code would help. All of those lines run in the Start method, except the AddHost line. That happens when a player clicks a UI. When I debug.log it, localSocket is 0. Right now, if I host and try to join on my LAN it works. Trying to port forward for people not on my LAN does not work.

Thanks!
-Michael

I think AddHost returns a socket ID and not the port number. You would have to use your “port” variable value for forwarding purposes.