When reading data in chunks of say, 1024, how do I continue to read from a socket that receives a message bigger than 1024 bytes until there is no data left? Should I just u
Also I troubled same problem.
When I tested several times, I found that sometimes multiple BeginReceive - EndReceive
makes packet loss. (This loop was ended improperly)
In my case, I used two solution.
First, I defined the enough packet size to make only 1 time BeginReceive() ~ EndReceive();
Second, When I receive large size of data, I used NetworkStream.Read()
instead of BeginReceive() - EndReceive()
.
Asynchronous socket is not easy to use, and it need a lot of understanding about socket.