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:
-
If the packet type is in the IPX driver's table,
the packet is handed to the protocol
identified with the packet type;
the socket number is ignored.
For example, the IPX driver identifies SPX
packets by packet type rather than by the socket number.
IPX then uses the packet type to deliver the
packet to SPX.
SPX uses the socket number and the destination connection
ID to identify the appropriate process for an incoming packet.
-
If the packet type is the IPX driver's packet type,
the IPX driver uses the socket number to identify the protocol.
For example, the IPX
driver identifies NVT packets by the socket number.
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:
-
allocates an ipxAddr_t structure.
-
sets the socket value in the ipxAddr_t structure
before making the t_bind call.
-
ensures that the socket number is passed in high-to-low byte order.
-
allocates a t_bind structure.
-
initializes the structure's fields.
(The req.addr.buf field must point to the
ipxAddr_t structure allocated in step 1.)
-
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:
-
If the
sock
field of the ipxAddr_t
structure is set to 0, the IPX/SPX
driver attempts to allocate a dynamic socket number.
-
If both req and ret are set to 0,
the IPX/SPX driver assumes that the
application has requested a dynamic socket number,
and attempts to allocate and assign a dynamic socket number.
This method assumes that the application does
not need to know the value of the 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