Quote:
Originally Posted by Bob22341
Try adding brackets after your while statement. This is probably your problem because your while statement isn't doing anything right now.
ex:
for(){
while(){
arguments
}
}
|
That while loop is waiting until there is at least 1 byte received, then it fails the conditional and packs the two bytes into a 16 bit variable. It's just a "smart" waiting function.
Although on further inspection it might be a good idea to ensure the while loop waits to get 2 bytes instead of just 1, since you end up using 2 bytes of data. That way you don't accidentally skip a byte if you ReadByte() twice before the second byte you assume is there hasn't shown up. Thats the fun of events that are asynchronous
