Other Socket-Related Functions

In addition to the functions we have already seen, there are three Perl built-in functions related to sockets: send(), recv(), and socketpair(). We will use send() and recv() in later chapters of this book when we discuss TCP urgent data (Chapter 17), and the UDP protocol (Chapters 1720).

$bytes = send (SOCK,$data,$flags[,$destination])

The send() function uses the socket indicated by the first argument to deliver the data indicated by $data, to the destination address indicated by $destination. If the data was successfully queued for transmission, send() returns the number of bytes sent; otherwise, it returns undef. The third argument, $flags, is the bitwise OR of zero or more of the two options listed in ...

Get Network Programming with Perl now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.