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

Connection.Tcp #1

Open
MaxLevs opened this issue Feb 18, 2021 · 1 comment
Open

Connection.Tcp #1

MaxLevs opened this issue Feb 18, 2021 · 1 comment
Labels
bug Something isn't working question Further information is requested

Comments

@MaxLevs
Copy link

MaxLevs commented Feb 18, 2021

Can I ask something? Why don't you return received data but count of this data in SendByTcp()?

networkStream.Write(data, 0, data.Length);
int byteCount = networkStream.Read(buffer, 0, buffer.Length);
return BitConverter.GetBytes(byteCount);

But here you try to represent it like it is an answer "as-is".

MCQuery/MCQuery/Query.cs

Lines 68 to 71 in 2358706

byte[] tcpResponse = SendByTcp(address, port, basicStatMessage);
if (tcpResponse.Length == 0) return new byte[] { };
return tcpResponse;

Maybe you mean something like that?

var res = new byte[byteCount];
Buffer.BlockCopy(buffer, 0, res, 0, byteCount);
return res;
@Aquerr
Copy link
Owner

Aquerr commented Jun 2, 2021

Probably yes. It may be a mistake.

It is an old project (made mostly for fun) and honestly I hardly remember anything.

@Aquerr Aquerr added bug Something isn't working question Further information is requested labels Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants