[Chapter 3] 3.2.4 accept
Author: Larry Wall, Tom Christiansen & Randal L. Schwartz
Date: 1999-07-02T01:47:27Z

#

| Chapter 3 Functions |

### 3.2.4 accept

    accept NEWSOCKET, GENERICSOCKET

This function does the same thing as the accept system call - see accept(2). It is used by server processes that wish to accept socket connections from clients. Execution is suspended until a connection is made, at which time the `NEWSOCKET` filehandle is opened and attached to the newly made connection. The function returns the connected address if the call succeeded, false otherwise (and puts the error code into $!). `GENERICSOCKET` must be a filehandle already opened via the socket operator and bound to one of the server's network addresses. For example:

    unless ($peer = accept NS, S) {
        die "Can't accept a connection: $!\n";
    }

See also the example in the section "Sockets" in Chapter 6, Social Engineering.

3.2.3 abs |  | 3.2.5 alarm