Finally, this source uses the inetd superserver to create a simple network server that will echo any characters received back to the client. This can be demonstrated by telnetting into the host board and typing some characters.
//echo.c
//All this file does is echo any data written to its standard
//input to it’s standard output. If run from the commandline
it
//will echo typed characters. If you add this line to your
///etc/inetd.conf file
//
//24 root tcp nowait /path/to/echo
//And then try to telnet to port 24 of your dimmPCI develop- ment
//board it will echo any charcters sent via the telnet
//connection.
#include <unistd.h> #include <stdio.h> int main (void)
{
char c;
while (read (fileno (stdin), &c, 1) >= 0) { write (fileno (stdout), &c, 1);
}
return 0;
}
www.amctechcorp.com | 53 |