- Home /
[UNET] Connection between Client and Server dies without message
I have a project where the client requests data in chunks of 8204 bytes per message from the server. The code is laid out so that the client can NOT request another chunk before the pending request has been fulfilled (to prevent a sudden income of lots of data).
However, at some point the connection between client and server seems to abrupt without any warning or error message. The player prefab disappears on the server, and the client can't send any more requests.
Also, upon adding "sent request", "received response" to client, and "received request", and "sent response" to server, I have found out the following:
The connection always breaks when there is a pending request for data by the client, e.g.:
Client: Sent request Received response Sent request
Server: Received request Sent response
The server has NEVER finished saying "received request", so something on the way from the client to the server must be faulty. Also, sometimes the connection breaks after 1 request, sometimes after 500 and sometimes it doesn't break at all (although the more requests you send, the more likely it is to break, so not breaking is highly unlikely).
I have found that removing the NetworkTransform script from my player prefab increased the likelihood of it working. That said, the likelihood is still very, very low.
With logging enabled, the server gives me these last messages (this is from a scenario where the connection broke after 1 request):
ConnectionRecv con:1 bytes:13 msgId:5 FB83E04C57030030FBF0FFFFFF UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()
ConnectionSend con:1 bytes:8204 msgId:3214 0000000030000000F0FFFFFF04000400040004000400040004000400040004000400040004000400040004000400040004000400040004000400040004000400040004000400040004000400040004000400040004000400040004000400040004000400040004000400040004000400040004000400040004000400040004000400040004000400040004000400040004000400 UnityEngine.Networking.NetworkConnection:SendWriter(NetworkWriter, Int32) NetworkPlayerEnabler:SendChunk(NetworkConnection, Int32, Int32, Int32, UInt16[]) (at Assets/_Scripts/Networking/Player/NetworkPlayerEnabler.cs:255) NetworkPlayerEnabler:CmdPopulateChunk(Int32, Int32, Int32) (at Assets/_Scripts/Networking/Player/NetworkPlayerEnabler.cs:231) NetworkPlayerEnabler:InvokeCmdCmdPopulateChunk(NetworkBehaviour, NetworkReader) UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()
ConnectionSend con:1 bytes:1 msgId:1 03 UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()
msgId 5 is the request to send out a chunk, msgId 3214 is the response (containing the chunk), but msgId 1 is something I don't know, and it only appears once the connection broke. The client only shows the request, receive, request and nothing special.
The channel type I'm using is reliable fragmented, but I've also tried with reliable sequenced, unreliable fragmented and unreliable sequenced. Results were the same.
If the application runs as host, everything works fine, without a single problem.
Any help to get this fixed somehow is appreciated.
Your answer
![](https://koobas.hobune.stream/wayback/20220612045134im_/https://answers.unity.com/themes/thub/images/avi.jpg)