diff options
author | sotech117 <michael_foiani@brown.edu> | 2023-09-21 07:06:14 +0000 |
---|---|---|
committer | sotech117 <michael_foiani@brown.edu> | 2023-09-21 07:06:14 +0000 |
commit | 9ba49f755e152d0996a43e8da7d146b8d2069051 (patch) | |
tree | dde7fe228fc6ab44c3c462576a391193e3189da5 /listener.c | |
parent | 433f6eb3a54881913286aa620db93c003c436c16 (diff) |
add timeout
Diffstat (limited to 'listener.c')
-rw-r--r-- | listener.c | 11 |
1 files changed, 1 insertions, 10 deletions
@@ -34,7 +34,6 @@ int main(int argc, char *argv[]) int rv; int numbytes; struct sockaddr_storage their_addr; - char buf[MAXBUFLEN]; socklen_t addr_len; char s[INET6_ADDRSTRLEN]; @@ -82,6 +81,7 @@ int main(int argc, char *argv[]) int count = 0; + char buf[MAXBUFLEN]; while(1) { // printf("\nlistener: waiting to recvfrom... %d times\n", count++); @@ -91,15 +91,6 @@ int main(int argc, char *argv[]) perror("recvfrom"); exit(1); } - // buf[numbytes] = '\0'; - - //printf("listener: got packet from %s\n", - // inet_ntop(their_addr.ss_family, - // get_in_addr((struct sockaddr *)&their_addr), - // s, sizeof s)); - //printf("listener: packet is %d bytes long\n", numbytes); - //buf[numbytes] = '\0'; - //printf("listener: packet contains \"%s\"\n", buf); // print the size write(STDOUT_FILENO, buf, numbytes); |