Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

When using NetworkStream, occasional corruption of data #11

Closed
GoogleCodeExporter opened this issue Mar 25, 2015 · 3 comments
Closed

When using NetworkStream, occasional corruption of data #11

GoogleCodeExporter opened this issue Mar 25, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1) Send data as fast as possible, insuring that the remote end checks the 
integrity of data
2) Once we reach the point where the local buffer is full and Udt::send cannot 
send the entire chunk, stream corrupts

What is the expected output? What do you see instead?
Basically the stream when reassembled on the other end has a multiple of 
1008-byte chunks missing

What version of the product are you using? On what operating system?
0.7.0.0 on Windows 7 and Windows XP

Please provide any additional information below.

I think this fixes the bug, we need to check to see if the entire chunk was 
written correctly:


void NetworkStream::Write(cli::array<System::Byte>^ buffer, int offset, int 
count)
{
    AssertNotDisposed();

    if (!CanWrite)
        throw gcnew NotSupportedException("Stream does not support writing.");
    int sent = 0;
    while (count > 0)
    {
        sent = _socket->Send(buffer, offset, count);
        count -= sent;
        offset += sent;
    }

}


Original issue reported on code.google.com by [email protected] on 6 Aug 2013 at 4:29

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant