|
|
HP 9000 Networking: BSD Sockets Interface Programmer's Guide > Chapter 8 Programming HintsPortability Issues |
|
This section describes implementation differences between 4.3 BSD Sockets and HP-UX IPC. It contains porting issues for: Because HP-UX IPC is based on 4.3 BSD Sockets (it is a subset of 4.3 BSD), programs should port easily between HP-UX and 4.3 BSD systems. If you need to have portable applications, keep the information described in this appendix in mind when you write your IPC programs. The following is a list of differences in IPC functions and library calls to watch out for if you want to port your IPC applications between HP-UX and 4.3 BSD systems. When shutdown has been used on a datagram socket on an HP-UX system, the local port number bound to that socket remains unavailable for use until that socket has been destroyed by close. Some other systems free that port number for use immediately after the shutdown. In general, sockets should be destroyed by close (or by terminating the process) when they are no longer needed. This allows you to avoid unnecessary delay in deallocating local port numbers. The functions htonl, htons, ntonl and ntons are not required on HP-UX systems. They are included for porting to a DEC VAX host. You can use these functions in your HP-UX programs for portability; they are defined as null macros on HP-UX systems, and are found in netinet/in.h. For HP-UX systems, the FIONREAD ioctl request on a datagram socket returns a number that may be larger than the number of bytes actually readable. Previously, HP-UX systems returned the maximum number of bytes that a subsequent recv would be able to return. HP-UX sets the actual size of the queue for pending connections to 3/2 * B+1, where B is the backlog value specified in the listen() function. This may change in future releases, but it will not be smaller than the backlog value. The following is a list of differences in functions and library calls to watch out for when you port your IPC applications between HP-UX and 4.3 BSD systems. 4.3 BSD terminal ioctl calls are incompatible with the HP-UX implementation. These calls are typically used in virtual terminal applications. The HP-UX implementation uses UNIX System V compatible calls. Look for the pty masters in /dev/ptym/ptyp? and for the pty slaves in /dev/pty/ttyp?. An alternative location to check is /dev. The 4.3 BSD /etc/utmp file format is incompatible with the HP-UX implementation. The HP-UX implementation uses UNIX System V compatible calls. Refer to the utmp(4) man page for details. Certain commonly used library calls in 4.3 BSD are not present in HP-UX systems, but they do have HP-UX equivalents. To make code porting easier, use the following equivalent library calls. You can do this by putting them in an include file, or by adding the define statements (listed in the following table) to your code. Table 8-4 Definition of Library Equivalents
|
|