WriteAsync doesn't always send data to all connected clients
I am making an application that has a TCP client that listens for messages from a TCP server, then puts those messages in a queue, then sends all of the queued messages to the connected TCP clients of the server started. The application is working, but sometimes
WriteAsync
doesn't send the same amount of messages to all clients. Any ideas of what the issues is, and also what can I improve on in this code?
https://hastebin.com/fejosepufi.csharp
ThanksHastebin: Send and Save Text or Code Snippets for Free | Toptal®
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
12 Replies
Are you checking the logs for any errors?
There are no errors, if I step through it in debug, all of the messages are sent
If I run it without breakpoints, the problem occurs
have you checked any receive errors?
Ah, it looks to be combining the messages
Any idea on how I could prevent that?
idk i havent read through your code properly
site and read how you are sending and recieving
Still seems strange as some clients receive 3 messages if sent 3 and other only receives 2
is this not just adding the message into the same array?
so you'd need to determine how big the message being sent is
somehow
True, so I only read in a certain amount of bytes, then can cut it off
yea
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View