HPlogo HP 9000 Networking: BSD Sockets Interface Programmer's Guide > Chapter 8 Programming Hints

Troubleshooting

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Glossary

 » Index

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.

© 1997 Hewlett-Packard Development Company, L.P.