|
|
1.1 root 1: /* udpecho.c - udpecho */
2:
3: #include <conf.h>
4: #include <kernel.h>
5: #include <network.h>
6:
7: #define MAXECHO 600 /* maximum size of echoed datagram */
8: static char buff[MAXECHO]; /* here because the stack may be small */
9:
10: /*------------------------------------------------------------------------
11: * udpecho - UDP echo server process (runs forever in background)
12: *------------------------------------------------------------------------
13: */
14: PROCESS udpecho()
15: {
16: int dev, len;
17:
18: if ( (dev=open(INTERNET, ANYFPORT, UECHO)) == SYSERR) {
19: printf("udpecho: open fails\n");
20: return(SYSERR);
21: }
22: while ( TRUE ) {
23: len = read(dev, buff, MAXECHO);
24: write(dev, buff, len);
25: }
26: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.