| Author | Ali Rahimi (ali@XCF.Berkeley.EDU) |
| Organization | XCF |
| Date | Jun 8, 1996 |
| Purpose | Provides routines for writing the network part of a TCP based network server. Uses accessor functions to fit in as seamlessly as possible into the rest of your program without imposing any unnecessary restriction on the structure of your server. |
| Portability | POSIX |
| ClientPtr | Represents the state of a client connection. This package accesses the fields of this data structure through accessor functions only. |
| Function | Description | Doc |
| NetMakeWelcome() | Creates a socket that listens for incoming connections. | More |
| NetNewConnection() | Waits for a new connection. | More |
| NetCloseConnection() | Closes a client's connection. | N/A |
| NetClientDataAvail() | Returns the number of bytes available on the connection to a client. | N/A |
| NetGetClientHostname() | Gets the hostname of a remote client. | More |
| NetErrStr() | Returns a diagnostic message for the last failure. | N/A |
| NetErrNo() | Returns a diagnostic number for the last failure. | N/A |
| net.c | Implementation |
| net.h | Interface |
| server.h | Definition of the accessors and the ClientPtr type. You are expected to define the functions declared in this file somewhere else and to modify the definition of ClientPtr. |
test.c is test program that emulates a subset of the functionality of the finger daemon. The included server.h file provides an example of how to define ClientPtr and the accessor functions.
Using accessors is a good idea. If you don't think so, you are wrong and should go learn how to program.