Created
September 25, 2015 11:02
-
-
Save Marenz/adc7570c18dbbc858678 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
//before | |
in_buffer.length = packet_length; | |
conn.read(in_buffer); | |
// now | |
while ( in_buffer.length < packet_size && conn.connected ) | |
{ | |
if ( conn.waitForData(1.seconds) ) | |
{ | |
auto added_len = in_buffer.length + conn.leastSize > packet_size ? | |
packet_size : conn.leastSize; | |
in_buffer.length += added_len; | |
conn.read(in_buffer[$-added_len .. $]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment