Programming Perl

Programming PerlSearch this book
Previous: 3.2.19 closedirChapter 3
Functions
Next: 3.2.21 cos
 

3.2.20 connect

connect SOCKET, NAME

This function does the same thing as the connect system call - see connect(2). The function initiates a connection with another process that is waiting at an accept(2). The function returns true if it succeeded, false otherwise (and puts the error code into $!). NAME should be a packed network address of the proper type for the socket. For example:

connect S, $destadd
    or die "Can't connect to $hostname: $!\n";

To disconnect a socket, either close or shutdown. See also the example in the section "Sockets" in Chapter 6.


Previous: 3.2.19 closedirProgramming PerlNext: 3.2.21 cos
3.2.19 closedirBook Index3.2.21 cos