.\" -*-nroff-*-
.TH conn 3 "23 May 1999" "Straylight/Edgeware" "mLib utilities library"
+.\" @conn_fd
.\" @conn_init
.\" @conn_kill
.SH NAME
.nf
.B "#include <mLib/conn.h>"
+.BI "int conn_fd(conn *" c ", sel_state *" s ", int " fd ,
+.BI " void (*" func ")(int " fd ", void *" p ),
+.BI " void *" p );
+
.BI "int conn_init(conn *" c ", sel_state *" s ", int " fd ,
.BI " struct sockaddr *" dst ", int " dsz ,
.BI " void (*" func ")(int " fd ", void *" p ),
.PP
A few words are in order about
.BR conn_init 's
-detailed behaviour and return value. If the it returns \-1, the
-connection attempt has failed immediately (an error code is stored in
-the global variable
-.BR errno ),
+detailed behaviour and return value. If it returns \-1, the connection
+attempt has failed immediately, an error code is stored in the global
+variable
+.BR errno ,
the file descriptor has been
.IR closed ,
and the connection function will
appropriate error code is stored in
.BR errno .
.PP
+Alternatively, if you have a socket with a pending connection (i.e., a
+call to
+.BR connect
+returned \-1 and set
+.B errno
+to
+.BR EINPROGRESS ),
+you can call
+.BR conn_fd.
+Its arguments are the same as for
+.BR conn_init ,
+except that since the socket knows its a peer address the
+.I dst
+and
+.I dsz
+arguments are not given, and it can't fail.
+.PP
If you want to cancel the connection attempt before it finishes, call
.B conn_kill
with the address of the selector. The file descriptor is closed, and
.BR sel (3),
.BR mLib (3).
.SH AUTHOR
-Mark Wooding, <mdw@nsict.org>
+Mark Wooding, <mdw@distorted.org.uk>