code_junkie

What's the best way to monitor a socket for new data and then process that data

Nov 13th, 2011
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. { 'H', 'e', 'l', 'l', 'o', '' }
  2. { 'W', 'o', 'r', 'l', 'd', '' }
  3.  
  4. Server receives { 'H', 'e', 'l' }
  5. Data stored in byte buffer { 'H', 'e', 'l' }
  6. Check byte buffer for message terminator ''. None found. Buffer unchanged, no message processed.
  7. Server receives { 'l', 'o', '', 'W' }
  8. Data stored in byte buffer { 'H', 'e', 'l', 'l', 'o', '', 'W' }
  9. Check byte buffer for message terminator ''. 1 found, extracted message { 'H', 'e', 'l', 'l', 'o' } and buffer updated { 'W' }
Add Comment
Please, Sign In to add comment