Open miwarnec opened 10 months ago
The latest code version, still by this issue
The client is unity and the server is a C# console program. The above problem will still occur with a low probability.
I found the problem. The reason is that segment retransmission occurred before the Client received the Hello packet.
I was able to reproduce this and hack a workaround.
Server has multiple IP's and the server is listening on all of them, but client is calling by FQDN that points to an IP that is not first in the list of IP's configured on the NIC. When client tries to connect, the cookie response goes out on the first IP, not the one the client called on, so client never gets the cookie message, doesn't respond, and gets kicked for timeout (the log spam is a byproduct of client trying to coax the cookie msg out of the server).
Change your DNS to point the FQDN to the first IP on the NIC, or move the IP that it's pointed to up to be first on the NIC.
1) Disable Dual Mode on the Kcp Transport
2) Change Line 144 in KcpServer.cs from this
socket.Bind(new IPEndPoint(IPAddress.Any, port));
to this
socket.Bind(new IPEndPoint(IPAddress.Parse("1.2.3.4"), port));
(replace 1.2.3.4 with your actual IP you want to bind to)
A future PR that provides for entering IP or FQDN in Unity and use that for the binding above.
quick update. 'invalid cookie=0' warnings.
this is reproducable with 30 bots in a local project. client sends Hello as reliable. kcp spits out the message one or multiple times until acked. server gets the first hello, sets as authenticated server gets another hello that was in transit for ack, shows the warning that we got cookie=0 while authenticated.
solutions: researching. maybe send hello as unreliable to avoid the ack stuff and check easily if msg=hello then ignore cookie=0 because in transit
this one seems hard to reproduce. gathering user reports in this thread.
https://discord.com/channels/343440455738064897/467961162558865408/1167190009401585814