recv can return incomplete packets, so use a "leftover" buffer to save the data until the next go-around.
These are blocking send() functions so they should always accept all of the data, but here's an assert just in case.
Print a message before the assert so we know WTF just happened when the program dies.
Add a bit more data for testing purposes.
Refactor the data receiving code. Poll recv() once and if there are any incomplete packets, rely on the leftover to catch it next time.
Make the socket blocking when sending to ensure the entire message is sent. Unifying packet sending in one function. Rename socket functions for consistency.
Clear groups so we don't get the old groups also.
Reset time between server connections.
Close it on error, just in case.