Reassemble Multiple Split TCP Packets In C# RRS feed

  • Question

  • Just have hard time to figure out how to properly reassemble multiple TCP packets into the original one sent by a TCP server. Thanks!
    Tuesday, June 30, 2020 3:02 PM

All replies

  • Hi David,

    Without any code, all I do is make a few suggestions and point you to my blog post.

    You need to be reading the data into a buffer, in a loop. Hopefully the data coming in has start/end delimiters to indicate the start and end of a transmission, typically STX (which is a (char)2) and ETX (which is a (char)3), so that you can parse out an entire transmission.

    See my blog post (with code snippets) on the subject:

    ~~Bonnie DeWitt [C# MVP]

    Tuesday, June 30, 2020 4:09 PM
  • TCP should do this for you automatically.  That's just part of the protocol.  Do you have some higher level protocol sitting on top of TCP?

    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Wednesday, July 1, 2020 3:10 AM
  • Hi Tim, thank you very much for the deep understanding the TCP/IP protocol!
    Thursday, July 2, 2020 1:24 PM
  • Hi BonnieB, thank you very much for the excellent post which guide me to my application!
    Thursday, July 2, 2020 1:25 PM
  • Hi,

    Has your issue been resolved?

    If so, please click on the "Mark as answer" option of the reply that solved your question., so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Friday, July 3, 2020 1:22 AM