Skip to content

Instantly share code, notes, and snippets.

@nathanpc
Last active Dec 11, 2015
Embed
What would you like to do?
Fix for the QUIT bug in leafIRC
void *IRC_Client::handle_recv(void) {
// recv some data.
int numbytes;
char buffer[MAXDATASIZE];
while (true) {
numbytes = recv(socket_descriptor, buffer, MAXDATASIZE - 1, 0);
buffer[numbytes] = '\0';
if (numbytes == 0) {
cout << "Connection terminated" << endl;
system("stty cooked");
exit(0);
}
message_handler(buffer);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment