2 .TH conn 3mLib "23 May 1999" mLib
4 conn \- selector for nonblocking connections
7 .B "#include <mLib/conn.h>
9 .BI "void conn_init(conn *" c ", sel_state *" s ", int " fd ,
10 .BI " struct sockaddr *" dst ", int " dsz ,
11 .BI " void (*" func ")(int " fd ", void *" p ),
14 .BI "void conn_kill(conn *" c );
19 selector manages a nonblocking connection to a remote socket. The
20 selector's state is maintained in an object of type
25 selector must be initialized. This requires a call to
27 with a fairly large number of arguments:
32 object which needs to be initialized.
35 Pointer to a multiplexor object (type
37 to which this selector should be attached. See
39 for more details about multiplexors, and how this whole system works.
42 File descriptor for the socket you want to connect. This becomes the
45 selector until the connection attempt finishes. For example, if there's
46 an error, the descriptor will be closed.
49 Pointer to destination socket address for the connection. Make sure
50 that the address has the right family.
53 Size of the destination socket address.
56 A function to call when the connection is complete. It is passed the
57 file descriptor of the connected socket, and the pointer passed
62 argument. If the connection failed, a file descriptor value of \-1 is
63 passed, and the global
65 value is set appropriately.
68 An arbitrary pointer whose value is passed to the handler function when
69 the connection finishes.
71 If you want to cancel the connection attempt before it finishes, call
73 with the address of the selector. The file descriptor is closed, and
74 the selector becomes safe to be discarded.
76 Mark Wooding, <mdw@nsict.org>