Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Using socket calls in a network application z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference SC27-3660-00 |
|
You can use the following example to write a socket network application.
The example is written using C socket syntax conventions, but the
principles described apply to all of the following APIs:
Clients and servers wanting to transfer data have many calls from
which to choose. The read() and write(), readv() and writev(), and the send() and recv() calls can be used only on sockets that are connected.
The sendto() and recvfrom(), and sendmsg() and recvmsg() calls can
be used at any time. The example listed in Figure 1 illustrates the use of send()
and recv() calls:
Figure 1. An application
using the send() and recv() calls
The example in Figure 1 shows
an application sending data to a connected socket and receiving data in response.
The flags field can be used to specify additional options to send()
or recv(), such as sending out-of-band data. For more information
about these routines, see the following information:
There are three groups of calls to use for reading and writing
data over sockets:
A connected socket is either a stream socket for which a connection has been established, or it is a datagram socket for which you have issued a connect() call to specify the remote datagram socket address. |
Copyright IBM Corporation 1990, 2014
|