Created
September 13, 2011 01:52
-
-
Save dennda/1212964 to your computer and use it in GitHub Desktop.
Send & Receive
This file contains hidden or 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
// Send: | |
const uint8_t query = (uint8_t)USERNAME_QUERY; | |
const uint8_t length = (uint8_t)sizeof(query); | |
[stream write:&length maxLength:sizeof(uint8_t)]; | |
[stream write:&query maxLength:length]; | |
// Receive: | |
uint8_t length; | |
[inStream read:&length maxLength:sizeof(uint8_t)]; | |
uint8_t buffer; | |
[inStream read:&buffer maxLength:(uint)(length)]; | |
LOG_NETWORK(8, @"Read %d bytes. Content: '%s'", (int)(length), (char*)buffer); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment