|
|
1.1 ! root 1: /* test.c - main */ ! 2: ! 3: #include <conf.h> ! 4: #include <kernel.h> ! 5: #include <deqna.h> ! 6: #include <ether.h> ! 7: #include <ip.h> ! 8: #include <dgram.h> ! 9: #include <net.h> ! 10: ! 11: ! 12: /*------------------------------------------------------------------------ ! 13: * main -- UDP echo server that listens on port 7 and ! 14: *------------------------------------------------------------------------ ! 15: */ ! 16: main() ! 17: { ! 18: int echodev; ! 19: int len; ! 20: struct xdgram buff; ! 21: ! 22: printf("UDP Echo server at work...\n"); ! 23: ! 24: echodev = open(NETWORK, ANYFPORT, UECHO); ! 25: ! 26: while (TRUE) { ! 27: len = read(echodev, &buff, sizeof(struct xdgram)); ! 28: if (len == SYSERR) ! 29: continue; ! 30: write(echodev, &buff, len); ! 31: } ! 32: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.