0
\$\begingroup\$

I was trying out Unity Network LLAPI, I am following the this tutorial. I wrote everything the same, my server starts well and good with no errors.

When my client tries to add host

int hostId = NetworkTransport.AddHost(topology, port);

like this, it crashes with this error

Cannot open socket on ip {*} and port {12000}; check please your network, most probably port has been already occupied UnityEngine.Networking.NetworkTransport:AddHost(HostTopology, Int32, String) Client:Connect() (at path/to/game/files/Client.cs:35) UnityEngine.EventSystems.EventSystem:Update()

Now if I change port on client side it says Wrong IP or Port.

I tried looking but didn't find much. Don't know what is wrong. Also I'm on Linux

\$\endgroup\$
1
  • \$\begingroup\$ "Creating a host" means you open a server for others to connect to. You do that on the server, not on the client. When your network concept makes your game participants hybrids which both create and accept connections to other participants, they are usually referred to as "peers". \$\endgroup\$
    – Philipp
    Commented Feb 23, 2018 at 14:29

1 Answer 1

1
\$\begingroup\$

The reason of the error is that you didn't stop previous host and trying the adding new. With the same credential you are trying to add same server. So first stop host then, add host.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .