[RESOLVED] TCP client issue
Hello. I am using a TCP client to send and receive data, but for some reason the data it receives has a bunch of white spaces at the end of each message.
Code:
System.Text.StringBuilder income_message_client = new System.Text.StringBuilder();
void Manage_Connection_Client()
{
do
{
int read;
do
{
byte[] bytes = new byte[client.ReceiveBufferSize];
read = client.GetStream().Read(bytes, 0, bytes.Length);
income_message_client.Append(System.Text.Encoding.UTF8.GetString(bytes));
}
while (read == 0);
//do things based on data received
}
while (true);
}
The data I receive is: "Blablablabla123 (space) (space) (space) (space) (space) (space) (space) (space) (space)", while the data I send truly is "Blablablabla123"
(space) = " "