Add ping pong to magichat server
This commit is contained in:
parent
d268857953
commit
6f4769855e
@ -248,6 +248,11 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (strcmp(msg.msg, "PING") == 0) {
|
||||
snprintf(buffer, 1024, "{\"bbs\": \"SYSTEM\", \"nick\": \"SYSTEM\", \"msg\": \"PONG\" }\n");
|
||||
if (send(i, buffer, strlen(buffer), 0) == -1) {
|
||||
perror("send");
|
||||
}
|
||||
} else {
|
||||
for (j=0;j<client_count;j++) {
|
||||
if (clients[j]->fd == i) {
|
||||
|
Reference in New Issue
Block a user