DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Developing applications over IPX/SPX using TLI

Sequence of TLI functions for SPX

Applications that use SPX can be either server applications or client applications. The application type determines the sequence and the types of TLI calls made to access SPX.

Server applications need to:

Client applications need to:

Procedures for both server and client applications are presented below.

Server application calling sequence

A synchronous server application must:

  1. Open the SPX driver (/dev/nspx) using the t_open call. The t_open call returns a file descriptor (fd).

  2. Bind fd to a well-known socket number that client connection requests will arrive on using the t_bind call.

  3. Obtain a second file descriptor (fd2) using the t_open call with the device set to the SPX driver (/dev/nspx).

  4. Bind fd2 to a dynamic socket number using the t_bind call.

  5. Listen for incoming connection requests using the t_listen call.

  6. Fork a child upon receiving a connection request.

  7. The parent should close fd2 and return to step 3. The parent continues looping through steps 3 to 7 until the parent exits (skip to step 14). The forked child performs steps 8 through 13.

  8. The forked child issues a t_accept to accept the connection request using t_accept(fd, fd2, call).

  9. The forked child should close fd with t_close.

  10. The forked child uses t_snd or t_rcv to send or receive data on fd2.

  11. The forked child listens for or sends a disconnection indication using t_rcvdis or t_snddis.

  12. On exiting, the forked child unbinds fd2 using a t_unbind call.

  13. On exiting, the forked child closes fd2 using a t_close call.

  14. On exiting, the parent unbinds fd using a t_unbind call.

  15. On exiting, the parent closes fd using a t_close call.

Client application calling sequence

A synchronous client application must:

  1. Open the SPX driver (/dev/nspx) using the t_open call. The t_open call returns a file descriptor (fd).

  2. Obtain the address of the server to which to connect. The method for obtaining the address is up to the client application. ``IPX addresses'' describes procedures for obtaining addresses.

  3. Bind to a static or dynamic socket using a t_bind call.

  4. Send a connection request to the server using a t_connect call.

  5. Use t_snd to send or t_rcv to receive data on fd.

  6. Listen for or send a disconnection request. Use t_rcvdis to receive a disconnect request or t_snddis to send a disconnect request.

  7. On exiting, use the t_unbind call to close the file descriptor obtained in step 1.

  8. On exiting, use the t_close call to close the file descriptor obtained in step 1.

Next topic: SPX driver characteristics
Previous topic: Using the SPX protocol

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003