2 .TH conn 3 "23 May 1999" mLib
6 conn \- selector for nonblocking connections
9 .B "#include <mLib/conn.h>
11 .BI "void conn_init(conn *" c ", sel_state *" s ", int " fd ,
12 .BI " struct sockaddr *" dst ", int " dsz ,
13 .BI " void (*" func ")(int " fd ", void *" p ),
16 .BI "void conn_kill(conn *" c );
21 selector manages a nonblocking connection to a remote socket. The
22 selector's state is maintained in an object of type
27 selector must be initialized. This requires a call to
29 with a fairly large number of arguments:
34 object which needs to be initialized.
37 Pointer to a multiplexor object (type
39 to which this selector should be attached. See
41 for more details about multiplexors, and how this whole system works.
44 File descriptor for the socket you want to connect. This becomes the
47 selector until the connection attempt finishes. For example, if there's
48 an error, the descriptor will be closed.
51 Pointer to destination socket address for the connection. Make sure
52 that the address has the right family.
55 Size of the destination socket address.
58 A function to call when the connection is complete. It is passed the
59 file descriptor of the connected socket, and the pointer passed
64 argument. If the connection failed, a file descriptor value of \-1 is
65 passed, and the global
67 value is set appropriately.
70 An arbitrary pointer whose value is passed to the handler function when
71 the connection finishes.
73 If you want to cancel the connection attempt before it finishes, call
75 with the address of the selector. The file descriptor is closed, and
76 the selector becomes safe to be discarded.
82 Mark Wooding, <mdw@nsict.org>