25,6 → 25,7 |
#include <unistd.h>/* close() */ |
#include <stdlib.h> |
#include <signal.h> |
#include <string.h> |
|
#define SERVER_PORT 20000 |
#define MAX_MSG 10000 |
105,6 → 106,8 |
cliLen = sizeof(cliAddr); |
n = recvfrom(sd, msg, MAX_MSG, 0,(struct sockaddr *)&cliAddr, &cliLen); |
|
if (strncmp(pkt_head->id,"TRACER",6)) continue; |
|
printf("Received %d, length %d(%d), %d tracer events.\n", |
pkt_head->pkt_number, n, pkt_head->size, pkt_head->events); |
|
113,17 → 116,16 |
miss = 1; |
} |
|
if (n > 0) { |
|
count++; |
|
if(n < 0) { |
printf("%s: cannot receive data \n",argv[0]); |
continue; |
} |
|
fwrite((void *)(msg+sizeof(struct tracer_udp_header)),n-sizeof(struct tracer_udp_header),1,output_file); |
|
} |
|
} |
|
fclose(output_file); |
|
return 0; |