Developing applications over IPX/SPX using TLI

Socket numbers

IPX uses the network number and node number to identify the computer that receives the packet. IPX uses the socket number to identify the process that receives the packet.

The IPX driver maintains a socket table that maps the socket number to a specific process. Each process must request a unique socket number; the driver does not assign the same socket number to two processes.

If the application is using a protocol that has been built on top of IPX, the IPX driver identifies the process by first using the protocol's packet type. It then proceeds as follows:

There are two types of socket numbers:

dynamic socket numbers
are assigned by IPX when an application binds to a transport provider with t_bind. A dynamic socket number is an unused socket number returned by the IPX driver and is guaranteed to be a unique unused number among the IPX endpoints. IPX keeps track of which socket number is bound to which transport endpoint. Dynamic socket numbers range from 0x4000 to 0x4FFF.

static socket numbers
can be requested in the req t_bind structure. If the socket number is unused, it is granted and returned in the ret t_bind structure. A static socket number is granted by IPX when an application requests a particular socket number and that particular socket number has not already been assigned to another process. Static socket numbers are in the range of 0x8000 to 0xFFFF, and are assigned by Novell. Contact Novell for a static socket number.
Procedures for obtaining a static socket number are described in ``Obtaining a static socket number''. Procedures for obtaining a dynamic socket number are described in ``Obtaining a dynamic socket number''.

Obtaining a static socket number

Static socket numbers are requested as part of the t_bind routine which must follow a t_open call, as described in ``Using the IPX protocol'' and ``Using the SPX protocol''. To obtain a static socket number, an application:

  1. allocates an ipxAddr_t structure.

  2. sets the socket value in the ipxAddr_t structure before making the t_bind call.

  3. ensures that the socket number is passed in high-to-low byte order.

  4. allocates a t_bind structure.

  5. initializes the structure's fields. (The req.addr.buf field must point to the ipxAddr_t structure allocated in step 1.)

  6. makes the t_bind call by passing the file descriptor returned by the t_open call and by passing the address of the t_bind structure allocated in step 3 as both the req and the ret values.

The IPX/SPX driver looks at the socket field in the ipxAddr_t structure for the desired socket number. The socket number must be passed using a high-to-low byte order. If the socket number desired is not currently being used, the driver returns the local network number, local node number, and the allocated or requested socket number in the corresponding fields of the ipxAddr_t structure of the ret.addr.buf field.

Only one IPX/SPX endpoint can bind to a given socket number at a time. If an application tries to bind to a socket that has already been bound, an error results and the bind fails.

Services written to run over IPX/SPX generally have well-known or static socket numbers associated with them. Static socket numbers ensure that server and client application types match.

Another method to coordinate servers and clients is to use SAP (the Service Advertising Protocol). ``Using the SAP protocol'' describes this method.

Obtaining a dynamic socket number

There are two methods by which an application obtains a dynamic socket number:

Next topic: Novell object types
Previous topic: Obtaining a destination address

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