Simple .NET TCP Framing Example

Recently, Jon Cole from the System.Net QA team posted a great article in response to questions we’ve received on our .Net Networking Forum (  His post can be found here:

Excerpt from the article:

A common misunderstanding for developers new to network programming over TCP sockets is how messages are sent and received.  I frequently hear the statement that “my data is not arriving on the other side of the socket in the same format that I sent it.”  The most common cause of this is because the TCP protocol does not guarantee that it will keep message boundaries.  In other words, you could send “Hello World” in a single call to Send(), but the other side of the socket stream may have to do multiple Receive() calls on the socket to get all of the data (the first Receive might return “he” and the second “llo world”).  ……..

— Mike Flasko

Comments (2)

  1. Debugging the ASP.NET worker process running at

    100% [Via: (Scott


  2. Ioan Herisanu says:

    If you send "Hello World" and receive "he" + "llo world" then you have not a TCP socket.  For TCP one should have received "He" + "llo World". Please, pay attention when working with these,as some novices will understand really bad things