Next: 6.0.1 The Socket() call
Up: Simulation Environment Overview 15-441
Previous: 5.3 Getting packets received
6 The Socket API
The socket layer provides an API (application program interface) for
user programs to access the networking functionality of the kernel.
In project 1, you wrote your FTP server using the socket API provided by
the Solaris kernel, for example, socket(), bind(),
accept(), etc. These calls are ``system calls'' provided by the
kernel so that user programs can use kernel functionalities.
For user programs to interface to the simulator, you can use the
following socket calls: Socket(), Close(), Bind(),
Read(), Write(), Sendto(), Recvfrom(), and Setsockopt().
Their prototypes are defined in $PDIR/include/Socket.h (this header
file should be included by user programs, not your kernel).
There are two important issues regarding these calls:
- Observe that the first letter of each call is capitalized.
This is to distinguish them from the actual Solaris system calls, which
will go into the Solaris kernel upon invocation. All your user programs will
be linked against a library provided by us so that when they invoke these
capitalized calls, the corresponding handlers in
our simulated kernel (not Solaris) are called.
- These calls meet the standard specifications, as described
by the man pages of the ``lower-case'' versions on a Solaris machine
or by Stevens' network programming book [1]. However,
there are some exceptions (for example, added flags for some calls) which will
be described in the remainder of this section.
Subsections
Next: 6.0.1 The Socket() call
Up: Simulation Environment Overview 15-441
Previous: 5.3 Getting packets received