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 3665112
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:43:20+00:00 2026-05-19T01:43:20+00:00

We have done some basic TCP communication, but have a few questions. We are

  • 0

We have done some basic TCP communication, but have a few questions. We are communicating with a TCP server where the transaction flow is described as follows:

The sender initiates the transaction
by sending an STX (ASCII 0x02)
character, then waits for the
recipient to reply by sending an ACK
(ASCII 0x06) character. After an ACK
is received, the sender transmits a
four-byte, unsigned, big-endian
integer representing the size of the
message payload, followed by the
payload, and finally a 16-byte MD5
message digest for the payload. If
the recipient is satisfied with the
message, it sends an ACK character.

<STX> = ASCII 0x02
<ACK> = ASCII 0x06

Sender: <STX>     <0x00><0x00><0x00><0x05><'H'><'E'><'L'><'L'><'O'><0xEB><0x61>...
Recipient:   <ACK>                                                                <ACK>

Using .Net sockets (System.Net.Sockets.Socket), what is the proper way to manage the STX/ACK transfer control? Does the socket handle this automatically (i.e. Do we simply call socket.Send(byteData)), or do we need to explicitly send the STX, wait for ACK, etc.?

The same goes for receiving: Do we simply receive the incoming data, or do we need to listen for an STX character, send an ACK, prepare for the payload, etc.?

If the transfer control is handled automatically, are there any specific socket flags that we need to set?

FYI: We found several links (like the following) that have proved useful for message framing, but none discuss the STX/ACK transfer control:

  • http://blogs.msdn.com/b/joncole/archive/2006/03/20/simple-message-framing-sample-for-tcp-socket.aspx
  • 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-19T01:43:21+00:00Added an answer on May 19, 2026 at 1:43 am

    Hehe, this used to be a serial port protocol, they probably just moved it unchanged to use sockets instead. Not that uncommon, although it isn’t very suitable for a stream like TCP implements.

    Well, follow the instructions. Assuming you are the client, read one byte and verify its is 0x02. If it is, send back one byte, 0x06. If not, keep reading until you see the 0x02. You’re now ‘connected’, but you already knew that.

    Next, read 4 bytes so you know the packet length, read as many bytes + 2 to get the rest of the packet. I’d ignore the ‘MD5 digest’, TCP is reliable enough to not have to double-check the validity of the received data. Send back one byte, 0x06.

    The only thing that isn’t clear is whether you should expect a 0x02 before the packet length or not. The text says you don’t, the diagram says you do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have done some basic Perl coding but never something in python. I would
I've done some Python but have just now starting to use Ruby I could
I've done some research into server push with javascript and have found the general
I'm working through the Stanford iPhone podcasts and have some basic questions. The first:
I'm an iPhone developer, but new to web development. I've done some basic HTML
I have done some searches looking for information about how to do logging with
Traditionally, when we use SQL string to done some work, we have to close
Has anyone done this / have some example code?
I have done Java and JSP programming in the past, but I am new
I have done a bit of testing on this myself (During the server side

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.