DarkRiftNetworking / Hazel-Networking

Hazel Networking is a low level networking library for C# providing connection orientated, message based communication via TCP, UDP and RUDP.
http://www.darkriftnetworking.com
MIT License
206 stars 44 forks source link

Bug in TcpConnection.cs, StartWaitingForChunk(StateObject state)? #1

Closed PaulKemppi closed 7 years ago

PaulKemppi commented 7 years ago

Hi, First of all, thank you for sharing the code GitHub. I noticed that large TCP packets (that arrive in several parts) are not received with the current version of the code. I fixed the problem by replacing line

socket.BeginReceive(state.buffer, state.totalBytesReceived, state.buffer.Length, SocketFlags.None, ChunkReadCallback, state);

with:

socket.BeginReceive(state.buffer, state.totalBytesReceived, state.buffer.Length - state.totalBytesReceived, SocketFlags.None, ChunkReadCallback, state);

Best Regards, Paul

JamJar00 commented 7 years ago

Thanks Paul, I've fixed this and pushed!