home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

3.2.20 connect





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 .