Results 1 to 3 of 3

Thread: [RESOLVED] TCP client issue

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2012
    Posts
    2

    Resolved [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) = " "
    Last edited by Krotcha87; Sep 1st, 2012 at 04:49 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width