HP Rp7410 BSD Sockets Interface Programmer's Guide - Page 167
Troubleshooting
View all HP Rp7410 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 167 highlights
Programming Hints Troubleshooting Troubleshooting The first step to take is to avoid many problems by using good programming and debugging techniques. Your programs should check for a returned error after each system call and print any that occur. For example, the following program lines print an error message for read: cc=read(sock,buffer,1000); if (cc
Chapter 8
167
Programming Hints
Troubleshooting
Troubleshooting
The first
step to
take is to avoid many problems by using good
programming and debugging techniques. Your programs should check for
a returned error after each system call and print any that occur. For
example, the following program lines print an error message for
read
:
cc=read(sock,buffer,1000);
if (cc<0) {
perror (“reading message”)
exit(1)
}
Refer to the
perror(3C)
man page for more information . Also refer to
the appropriate man page for information about errors returned by the
BSD Sockets system calls such as
read
.
You can also compile your program with the debugging option (-g) and
use one of the debuggers (e.g.
cdb
or
xdb
) to help debug the programs.
It is possible that you could assign a reserved port address and cause a
service to fail. For example, if the
nftdaemon
is not running, and you
assign its port, when you try to start the
nftdaemon
, it fails. See the
/etc/services
file for the list of reserved ports.