Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete Reply #2

Open
FaisalFagihi opened this issue Sep 6, 2023 · 0 comments
Open

Incomplete Reply #2

FaisalFagihi opened this issue Sep 6, 2023 · 0 comments

Comments

@FaisalFagihi
Copy link

Sometimes IReply.RawBytes stores only one byte and ignores the rest of the response bytes.

int firstByte = stream.ReadByte();
if (firstByte is not -1)
{
    reply.RawBytes = new Memory<byte>(new byte[tcpSocket.Available + 1]);
    _ = stream.Read(reply.RawBytes.Span[1..]);
    reply.RawBytes.Span[0] = (byte)firstByte;
    reply.Status = CommunicationStatus.ReplyReceived;
    Log?.Invoke("Rx: " + StringHelper.GetHexString(reply.RawBytes));
}

changing the RawBytes array size fixed the issue.

https://github.com/Touseefelahi/Communication/blob/31e00fbe3a3fd4771e4133e57ab09ed4bbf128f8/Communication/Services/Transciever.cs#L169C1-L170C1

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

No branches or pull requests

1 participant