Example client and server code
The following code implements a client and server that
communicate using XTI
over a NetBIOS connection. The server
opens the file logfile, reads the contents in 1K
chunks, and sends each chunk to the client. The client
reads each chunk of data over the NetBIOS connection,
then writes it to the standard output.
This code has at least two interesting features:
-
The server is concurrent, that is, it communicates with
the client through a child process that uses a transport endpoint
(conn_fd) different from the one that the
parent process listens on for
incoming connection requests (listen_fd).
This, along with a value for bind
->qlen
that
is greater than one (five, in this example) in the call to
t_bind, allows the server to respond to incoming
connection requests in parallel.
-
The client and server implement an application-level protocol to
ensure that the client receives all the data that the server sends.
The application implements this protocol because SCO
NetBIOS and NetBEUI do not support a
connection-oriented service with orderly release.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004