Created
February 5, 2014 21:40
-
-
Save jbrjake/8833728 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You have a stream of bytes in char array buf[]: | |
00 00 00 0A 68 65 6C 6C 6F 77 6F 72 6C 64 | |
You know the bytes follow a protocol with this spec: | |
<1 byte> message type (0 == hello, 1 == goodbye) | |
<3 bytes> message length | |
<N> message content (UTF-8 characters) | |
Determine if this is a hello message, and, if it is, print the content as a string to stdout. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment