Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 611253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:45:50+00:00 2026-05-13T17:45:50+00:00

So I’ve been tasked with creating a tool for our QA department that can

  • 0

So I’ve been tasked with creating a tool for our QA department that can read packets off the wire and reassemble the messages correctly (they don’t trust our logs… long story).

The application whose communication I’m attempting to listen in on is using .NET’s TcpListener and TcpClient classes to communicate. Intercepting the packets isn’t a problem (I’m using SharpPcap). However, correctly reassembling the packets into application level messages is proving slightly difficult.

Some packets have the end of one message and the beginning of the next message in them and I can’t figure out how the NetworkStream object in .NET is able to tell where one application level message ends and the other begins.

I have been able to figure out that any packet that contains the end of an application level message will have the TCP header “PSH” (Push) flag turned on. But I can’t figure out how .NET knows where exactly the end of the message is inside that packet.

The data of one packet might look like:

/></Message><Message><Header fromSystem=http://blah

How does the stream know to only send up to the end of </Message> to the application and store the rest until the rest of the message is complete?

There are no IP level flags set for fragmentation, and the .NET sockets have no knowledge of the application level protocol. So I find this incredibly vexing. Any insight would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:45:51+00:00Added an answer on May 13, 2026 at 5:45 pm

    The stream doesn’t know the end of anything – it should be part of the application protocol.

    NetworkStream doesn’t have anything built into it to convert the data into an object. What makes you think it does? What does the code which manages to use the NetworkStream look like? Are you perhaps doing some form of XML deserialization, and the reading code automatically stops when it reaches the closing tag?

    Basically:

    • If your protocol doesn’t have any message delimiter or length prefix, it probably should have
    • NetworkStream itself is highly unlikely to be doing anything clever – but if you could tell us what you’re observing, we can maybe work out what’s going on.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bunch of posts stored in text files formatted in yaml/textile (from
I am trying to loop through a bunch of documents I have to put
I'm making a simple page using Google Maps API 3. My first. One marker
I have some data like this: 1 2 3 4 5 9 2 6

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.