Skip to main content
Code Review

Return to Question

Clarified question
Source Link

I have two while loops, one to first check start sequence (frame start), once done.

The second loop checks for the checksum value, end sequence (frame end) and if not end of valid, treats this isas a message payload and reads from the stream until a valid end sequence (frame end) is found. Each (n) payload starts with a 3 bytes header (2 bytes identifier + 1 byte length of the succeeding data) and then the actual data.

I have two while loops, one to first check start sequence (frame start), once done. The second loop checks for the checksum value, end sequence (frame end) and if not end of valid treats this is a message payload and reads from the stream until a valid end sequence (frame end) is found.

I have two while loops, one to first check start sequence (frame start), once done.

The second loop checks for the checksum value, end sequence (frame end) and if not, treats this as a message payload and reads from the stream until a valid end sequence (frame end) is found. Each (n) payload starts with a 3 bytes header (2 bytes identifier + 1 byte length of the succeeding data) and then the actual data.

Clarified question and review context
Source Link

Can I please havePlease advise on how to improve the method below that reads TCP datamessages including framing bytes, through a MemoryStream since I can't use NetworkStream? Is my checksum calculation correct? The sensor documentation indicates that to calculate it you must include all payload data except starting and ending sequence.

Can I please have advise on how to improve the method below that reads TCP data including framing bytes?

Please advise on how to improve the method below that reads TCP messages including framing bytes, through a MemoryStream since I can't use NetworkStream? Is my checksum calculation correct? The sensor documentation indicates that to calculate it you must include all payload data except starting and ending sequence.

added 1 character in body
Source Link
user73941
user73941

I have totwo while loops, one to first check start sequence (frame start), once done. The second loop checks for the checksum value, end sequence (frame end) and if not end of valid treats this is a message payload and reads from the stream until a valid end sequence (frame end) is found.

I have to while loops, one to first check start sequence (frame start), once done. The second loop checks for the checksum value, end sequence (frame end) and if not end of valid treats this is a message payload and reads from the stream until a valid end sequence (frame end) is found.

I have two while loops, one to first check start sequence (frame start), once done. The second loop checks for the checksum value, end sequence (frame end) and if not end of valid treats this is a message payload and reads from the stream until a valid end sequence (frame end) is found.

Post Reopened by Graipher, t3chb0t, Peter Taylor, Sᴀᴍ Onᴇᴌᴀ , alecxe
edited tags
Link
t3chb0t
  • 44.7k
  • 9
  • 84
  • 190
Loading
added 104 characters in body
Source Link
Loading
added 104 characters in body
Source Link
Loading
Added more context to improve the question
Source Link
Loading
Fixed spelling
Source Link
Loading
Post Closed as "Not suitable for this site" by Toby Speight, Peter Taylor, Heslacher, Sᴀᴍ Onᴇᴌᴀ , t3chb0t
edited title
Link
t3chb0t
  • 44.7k
  • 9
  • 84
  • 190
Loading
added 157 characters in body
Source Link
Loading
Source Link
Loading
lang-cs

AltStyle によって変換されたページ (->オリジナル) /