Macro | Package: socket | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version

## with-pending-connect

Arguments: &rest body

A call to make-socket can take a while (maybe a minute or two) to make or fail to make a connection.

If you want to limit the amount of time spent in the make-socket call you can write it with a with-timeout. If the timeout occurs, then the program gives up on trying to make the connection. However the connection is offically still pending and operating system resources will continue to be used. Thus, it's important to clean up after a timed out attempt to make a connection.

The best way to ensure that things are cleaned up is to use with-pending-connect. Just write your code something like this:

    (socket:with-pending-connect
      (sys:with-timeout (10 (error "connect failed"))
        (socket:make-socket
          :remote-host "foo.com" :remote-port 1234)))

The with-pending-connect wraps the body with an unwind-protect that will clean up the pending connection as control passes through it.

See socket.htm for general information on sockets in Allegro CL.

Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.2 page.
Created 2012.5.30.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version