Truncated And Silent
This datagram server works fine against the test client, which sends 200 byte messages. A new client sends a single 1200 byte datagram in one sendto() call.
char buf[512];
for (;;) {
struct sockaddr_storage from;
socklen_t fromlen = sizeof from;
ssize_t n = recvfrom(sfd, buf, sizeof buf, 0,
(struct sockaddr *)&from, &fromlen);
if (n < 0) { perror("recvfrom"); continue; }
handle(buf, (size_t)n); /* parse one complete message */
}
What does handle() see for that 1200 byte datagram?
Sign in to answer questions and track your progress
Sign In