NOTES

If you are running under version 5.000 (dubious) or 5.001, you can still use most of the examples in this document. You may have to remove the use strict and some of the my statements for 5.000, and for both you'll have to load in version 1.2 or older of the Socket.pm module, which is included in perl5.002.

Most of these routines quietly but politely return undef when they fail instead of causing your program to die right then and there due to an uncaught exception. (Actually, some of the new Socket conversion functions croak on bad arguments.) It is therefore essential that you should check the return values of these functions. Always begin your socket programs this way for optimal success, and don't forget to add -T taint checking flag to the pound-bang line for servers:

    #!/usr/bin/perl -w
    require 5.002;
    use strict;
    use sigtrap;
    use Socket;