Examples: Connection-oriented designs

There are a number of ways that you can design a connection-oriented socket server on the iSeries™. These example programs can be used to create your own connection-oriented designs.

While additional socket server designs are possible, the designs provided in these examples are the most common.

Iterative server

In the iterative server example, a single server job handles all incoming connections and all data flows with the client jobs. When the accept() API is completed, the server handles the entire transaction. This is the easiest server to develop, but it does have a few problems. While the server is handling the request from a given client, additional clients can be trying to get to the server. These requests fill the listen() backlog and some of the them are rejected eventually.

Concurrent server

In the concurrent server designs, the system uses multiple jobs and threads to handle the incoming connection requests. With a concurrent server there are typically multiple clients that connect to the server at the same time.

For multiple concurrent clients in a network, it is recommended that you use the asynchronous I/O socket APIs. These APIs provide the best performance in networks that have multiple concurrent clients.

Related concepts
Asynchronous I/O
Related reference
Example: Accept connections from both IPv6 and IPv4 clients
Example: Use asynchronous I/O
Example: Generic client
Related information
accept()
spawn()