z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Steps for Pascal language API procedure calls

z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
SC27-3660-00

This topic describes the steps of writing the Pascal program.

Before you begin

To use the Pascal language API, you should have experience in Pascal language programming and be familiar with the principles of internetwork communication.

Procedure

Perform the following steps to write the Pascal program.

  1. Start TCP/UDP/IP service (BeginTcpIp).

    _________________________________________________________________

  2. Specify the set of notifications that TCP/UDP/IP can send you (Handle).

    _________________________________________________________________

  3. Establish a connection (TcpOpen, UdpOpen, RawIpOpen, and TcpWaitOpen).
    Note: If using TcpOpen, communication must wait for the appropriate notification of connection.

    _________________________________________________________________

  4. Transfer a data buffer to or from the TCP/IP address space (TcpSend, TcpFSend, TcpWaitSend, TcpReceive, TcpFReceive, TcpWaitReceive, UdpSend, UdpNReceive, RawIpSend, UdpReceive, and RawIpReceive).
    Notes:
    1. TcpWaitReceive and TcpWaitSend are synchronous calls.
    2. TcpFSend and TcpSend are the asynchronous ways of sending data on a TCP connection. Both procedures return to your program immediately. TcpSend does not wait under any circumstance.
    3. TcpSend and TcpFSend differ in how they handle the situation when TCP/IP address space has insufficient buffer space to accept the data being sent.
    4. In the case of insufficient buffer space, TCP/IP responds to TcpSend with the return code NObufferSPACE. This return code is sent back to the application. It is the application's responsibility to wait for BUFFERspaceAVAILABLE notification and resend the data.
    5. In the case of TcpFSend with insufficient buffer space, the PASCAL API blocks until buffer space becomes available or an error is detected. This is the only condition under which TcpFSend blocks.

    _________________________________________________________________

  5. Check the status returned from TCP/IP in the form of notifications (GetNextNote).

    _________________________________________________________________

  6. Repeat the data transfer operations (Steps 4 and 5) until the data is exhausted.

    _________________________________________________________________

  7. Terminate the connection (TcpClose, UdpClose, and RawIpClose).
    Note: If you are using TcpClose, you must wait for the connection to terminate.

    _________________________________________________________________

  8. Terminate the communication service (EndTcpIp).

    _________________________________________________________________

Results

You know you are done when control is returned to you. Control is returned, in most instances, after the initiation of your request. When appropriate, some procedures have alternative wait versions that return only after request completion.

Example

A sample program is supplied with TCP/IP. See Sample Pascal program, for a listing of the sample program.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014