1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 3.2//EN">
4 <TITLE> [IRCServices Coding] ircservices5.0a28 various
6 <LINK REL=
"Index" HREF=
"index.html" >
7 <LINK REL=
"made" HREF=
"mailto:ircservices-coding%40ircservices.za.net?Subject=%5BIRCServices%20Coding%5D%20ircservices5.0a28%20various&In-Reply-To=3cb8ede0.13655%40achurch.org">
8 <META NAME=
"robots" CONTENT=
"index,nofollow">
9 <META http-equiv=
"Content-Type" content=
"text/html; charset=us-ascii">
10 <LINK REL=
"Previous" HREF=
"000549.html">
11 <LINK REL=
"Next" HREF=
"000551.html">
13 <BODY BGCOLOR=
"#ffffff">
14 <H1>[IRCServices Coding] ircservices5.0a28 various
</H1>
16 <A HREF=
"mailto:ircservices-coding%40ircservices.za.net?Subject=%5BIRCServices%20Coding%5D%20ircservices5.0a28%20various&In-Reply-To=3cb8ede0.13655%40achurch.org"
17 TITLE=
"[IRCServices Coding] ircservices5.0a28 various">v13 at it.teithe.gr
19 <I>Sun Apr
14 05:
22:
01 PDT
2002</I>
21 <LI>Previous message:
<A HREF=
"000549.html">[IRCServices Coding] ircservices5.0a28 various
23 <LI>Next message:
<A HREF=
"000551.html">[IRCServices Coding] ircservices5.0a28 various
25 <LI> <B>Messages sorted by:
</B>
26 <a href=
"date.html#550">[ date ]
</a>
27 <a href=
"thread.html#550">[ thread ]
</a>
28 <a href=
"subject.html#550">[ subject ]
</a>
29 <a href=
"author.html#550">[ author ]
</a>
34 <PRE>On Sunday
14 April
2002 14:
46, Andrew Church wrote:
35 ><i> "Already connected
" sounds like it's ignoring the fact that the socket
36 </I>><i> is non-blocking (or maybe my logic is wrong).
38 I'm not
100% sure about this.. anyway...
42 if ((i = connect(fd, (struct sockaddr *)
&sa, sizeof(sa)))
< 0
43 && errno != EINPROGRESS
48 s-
>flags |= SF_CONNECTED;
49 FD_SET(fd,
&sock_fds);
51 s-
>cb_connect(s,
0);
53 s-
>flags |= SF_CONNECTING;
54 FD_SET(fd,
&write_fds);
57 So a non blocking connect() returns EINPROGRESS and (s-
>flags
& SF_CONNECTING)
60 After that, when the connection is established, in sockets.c:
296 in function
63 } else if (s-
>flags
& SF_CONNECTING) {
64 /* Connection established (or failed) */
66 log(
"debug: sockets: connect on fd %d returned
", i);
67 res = connect(s-
>fd, (struct sockaddr *)
&s-
>remote,
68 sizeof(s-
>remote));
70 So you're calling connect() twice and the
2nd call is done when the socket
71 *IS* connected, since writeability indicates the connection is established.
73 ><i> --Andrew Church
74 </I><<V13
>>
82 <LI>Previous message:
<A HREF=
"000549.html">[IRCServices Coding] ircservices5.0a28 various
84 <LI>Next message:
<A HREF=
"000551.html">[IRCServices Coding] ircservices5.0a28 various
86 <LI> <B>Messages sorted by:
</B>
87 <a href=
"date.html#550">[ date ]
</a>
88 <a href=
"thread.html#550">[ thread ]
</a>
89 <a href=
"subject.html#550">[ subject ]
</a>
90 <a href=
"author.html#550">[ author ]
</a>