This chapter covers the following topics:
The Socket interface library has been implemented to operate across the QNX network. This means that TCP/IP application programs can run on any computer in the QNX network.
This chapter provides specific information about generating socket-based applications in QNX.
The QNX TCP/IP socket interface is a set of library functions and header files. All memory models of the socket interface library are provided. They're called socketx.lib, where x denotes the memory model. For a description of memory models, see the documentation of the cc utility in the C Library Reference.
These libraries are installed in the /usr/lib directory. For references to socket functions, see the TCP/IP Libraries chapter in this guide.
The header files are installed under the /usr/include directory.
To compile socket programs, use the cc utility.
You should link with the following command:
cc -l socket -l unix program_name
The -l socket ("el") option causes the linker to automatically append the letter for the appropriate memory model before referencing the socket library.
Specifying -l unix causes the linker to include the UNIX compatibility library. This ensures that the appropriate historical (non-POSIX) UNIX functions are available.
The linking order of the libraries is important. Be sure to specify the -l socket option before the -l unix option. |
Before a program can be executed, the Socket Manager (Tcpip) must be running somewhere in the QNX network. For more information about Tcpip, see the TCP/IP User's Guide.
If you have multiple Socket Managers running on different nodes in your QNX network, you can select a specific one by typing either:
SOCK=node_ID command
Or:
export SOCK=node_ID; command
where:
If you use the second form, all subsequent commands are affected. For more information, see the LAN Configuration chapter in the TCP/IP User's Guide.
When running an executable, a Socket Manager is located by the following search order:
If you don't want your Socket to be located in a global search by a utility on another node, start as:
Tcpip -L