Skip to content

Commit 7eba38b

Browse files
committed
do not expect connect() to succeed
1 parent 263c150 commit 7eba38b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

network.tex

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -511,10 +511,11 @@
511511
\funnm{connect}() will not block while waiting to connect. It will return
512512
\texttt{-1} with \texttt{errno} set to \texttt{EINPROGRESS} (= ``not possible to
513513
create a connection right away'') and the connection request is stored in the
514-
system queue to be processed. Until the connection is ready, subsequent
515-
\funnm{connect}()s return \texttt{-1} with \texttt{errno} set to
516-
\texttt{EALREADY}. However, using this way to test the connection readiness is
517-
not the right approach as if the background connection attempt fails, the next
514+
system queue to be processed. Until the connection is known (i.e. successfully
515+
connected or failed), subsequent \funnm{connect}()s return \texttt{-1} with
516+
\texttt{errno} set to \texttt{EALREADY}.
517+
However, using this way to test the connection readiness is not the right
518+
approach as if the background connection attempt fails, the next
518519
\funnm{connect}() tries to create a new connection and we would end up in a
519520
never ending loop. The right approach is to use \funnm{select}() or
520521
\funnm{poll}(), see pages \pageref{SELECT} and \pageref{POLL}. You can also

0 commit comments

Comments
 (0)