recv large amounts of data
I'm writing a chat bot for PvPGN BnetD. The format will look similar to this:
Quote:
1010 NAME kpreston
1018 INFO "Welcome to PvPGN BnetD 1.5.0!"
1018 INFO "Type /help for a list of commands."
1002 JOIN kpreston 0001
1003 LEAVE somedude 0001
1003 LEAVE somedude(1) 0001
1002 JOIN somedude(2) 0001
1003 LEAVE somedude(2) 0001
The server is restarted every 3-5 hours. When this happens, approx. 1000 users/bots will reconnect. The issue I'm having is when recv() returns this:
Quote:
1010 NAME kpreston\r\n
1018 INFO "Welcome to PvPGN BnetD 1.5.0!"\r\n
1018 INFO "Type /help for a list of commands."\r\n
1002 JOIN kpreston 0001\r\n
1003 LEAVE somedude 0001\r\n
1003 LEAVE somedude(1) 0001\r\n
1002 JOIN somedu
The buffer gets parsed by "\r\n," and I have an incomplete packet at the end, which will cause undefined behaivor if I don't have a ton of error checking.
How would you solve this?
Edit: Speed and efficiency is the MOST important aspect to consider.