Perl provides direct access to the C library routines for socket communication. Often, arguments and return values are constants defined in the C header files, or are data structures which Perl will pass in a packed binary format.
The Socket module provides these constants and also many functions for packing and unpacking these data structures.