%s\n", udp->body)。TCP/IP协议深度解析( 二 )。" />

TCP/IP协议深度解析( 二 )

< 0) continue;if (pfd.revents & POLLIN) {struct nm_pkthdr h;unsigned char *stream = nm_nextpkt(nmr, &h);struct ethhdr *eth = (struct ethhdr*)stream;if (ntohs(eth->proto) == PROTO_IP) {struct udppkt *udp = (struct udppkt*)stream;if (udp->ip.proto == PROTO_UDP) {int udp_length = ntohs(udp->udp.length);udp->body[udp_length-8] = '\0';printf("udp --> %s\n", udp->body);}}}}return 0; }
3安装
参考: