IPX/SPX Programming Manual

Library Routines
HP NonStop IPX/SPX Programming Manual528022-001
5-18
bind, bind_nw
address_len
is a value indicating the size in bytes of the IPX address data structure pointed to
by address_ptr. If set to 0, IPXPROTO chooses a BSD socket on the
application’s behalf.
tag
is the tag parameter to be used for the nowait operation initiated by bind_nw.
Errors
If an error occurs, the external variable errno is set to one of the following values:
Usage Guidelines
Use bind on a socket created for waited operations, or bind_nw on a socket
created for nowait operations. The operation initiated by bind_nw must be
completed with a call to the AWAITIOX procedure.
For information on error checking, see Nowait Call Errors on page 5-5.
For information on struct sockaddr_nv and struct sockaddr, see NonStop
IPX/SPX Data Structures on page 4-2.
Example
In this programming example, the bind routine is called to bind the socket fd to the
address and port number in the snv structure:
#include <socket.h>
#include <nv.h>
#include <netdb.h>
#define WELL_KNOWN_PORT 0x5555
...
struct sockaddr_nv snv;
...
/*
* The code here (not shown) should create a socket fd.
* Then the local network and host number
* in the snv structure are filled in by IPXPROTO since
* memset sets the network and host portion of the snv
* structure to 0. The port number is the WELL_KNOWN_PORT
* defined above.
EADDRNOTAVAIL The specified IPX address data structure was not
available on the local host.
EADDRINUSE The specified IPX address data structure was already in
use.
EINVAL The specified socket was already bound to an address, or
the address_len was incorrect.