Compiling and setting Up Unix Network Programming (UNP) LIBRARY
To develop their automated traders in an external machine, you need to install the UNP communication library provided by Richard Stevens' Unix Network Programming book The source code can be found at:. Http://www.kohala.com/start/unpv12e/ UNPV12E.TAR.GZ We Assume You Saved The File in A Directory That We Refer to as UNPV_DIR. After That, To Unzip and Uncer in The Current Directory:
Tar-xvzf unpv12e.tar.gz
That Should Create A Directory
UNPV12E IN
UNPV_DIR, AND UNCompress All The next., Files.
The next step is to compile the network library. Here is Stevens' Original Compiration Notes TOGETHER WITHER Comments Added To Ease Up The Compiration Process.
Quick and dirty (Originally By Richard Stevens, Edited by Plat Team)
ONCE you are inside unpv_dir,
CD UNPV12E ./configure # try u figure out all impLementation Differences CD lib # Build The Basic Library That All Program NEED MAKE # Use "gmake" Everywhere On BSD / OS Systems
IF you are unable to compile using
make '(the last step above), then follow the modifications suggested below and try again. The exact nature of the modifications needed might differ from one configuration to another. Below are general tips from our crux installation. After you change something in the UNP Source Code, We Recommend you Execute '
Make Clean 'Before Calling'
Make 'Again to Be Certain That Your Changes Are Fully Incorporated.
Notes on unp installation on crux
The Following Are The Particular Changes We needed to make for the unp installation on crux (unpv_dir = / usr / local):
Commented out a structure because it was a redefinition of a structure which was in the system's include libraries, with one extra field: (UNPV_DIR / unpv12e / lib / unp.h, line 113) / * Commented out the following because it is a redefinition of a structure * with slightly different / missing fields defined in system's original * header files * / // struct in_pktinfo {// struct in_addr ipi_addr;. / * dst IPv4 address * / // int ipi_ifindex; / * received interface index * / //};
Replaced the call to mktemp with call to mkstemp instead, since the latter is obsolete, and modified the function MKtemp accordingly (for example, mktemp returns NULL on error, but mkstemp returns -1 on error): (UNPV_DIR / unpv12e / lib / wrapunix .c, line 96)
/ * Changed the call to mktemp with call to mkstemp * / if (mkstemp (template) == -1 || template [0] == 0) err_quit ("mkstemp error");
That's all we needed to change for this part of the UNP installation process, and then the compilation worked without errors (for the most part, you can safely ignore any warnings you see during the UNP library compilation). In general, one additional possible change You might nesed to make is to edit the file
CONFIG.CACHE IN
UNPV_DIR / UNPV12E DIRECTORY. IF you get an error
GetNameInfo, you want to make sure what the folowing line regarding
GetNameInfo in
Config.cache is Exactly as Follows:
AC_CV_FUNC_GETNAMEINFO = $ {ac_cv_func_getnameinfo = yes}
(i.e., make sure it is set to "yes" as Above!). If you have to make this change, you shouth, you
UNPV_DIR / UNPV12E DIRECTORY,. / Configure CD LIB Make Clean Make
Before finishing off with the unp installation, you also need to execute the FOLLOWING:
CD UNPV_DIR / UNPV12E / LIBFREE # Continue Building The Basic Library Make
If All this Works (WITHOUT ERRORS!), You're Done with the compiration of the network.
If you wish, you can now safely remove the compressed file UNP package file you downloaded (or the tar file that resulted if you directly uncompressed the file) after successfully building the UNP library.