From: Geoffrey Lee <glee@gnupilgrims.org>
To: kuznet@ms2.inr.ac.ru
Cc: netdev@oss.sgi.com
Subject: Re: [PATCH] connect() return value.
Date: Tue, 13 Aug 2002 15:37:04 +1000 [thread overview]
Message-ID: <20020813053704.GA14788@anakin.wychk.org> (raw)
In-Reply-To: <200208130444.IAA20082@sex.inr.ac.ru>
On Tue, Aug 13, 2002 at 08:44:21AM +0400, kuznet@ms2.inr.ac.ru wrote:
> Hello!
>
> > it returns -EISCONN. This behavior is consistent in all operating
> > systems which I have tested, which include the following:
>
> This is very strange. Linux should return success once.
>
> Probably, I should explain why I ask this. This is a necessary
> element of implementation of restartable connect(). If connect()
> is restarted after signal, it should return success on connected
> socket sometimes rather than -EISCONN.
>
I see.
Possibly, I should be a bit clearer, to make sure that I am not
not confusing with what are you are asking for.
The summaries so far, for Linux:
(1) no signals (so it runs the sighandler but doesn't return from the
sys call until it completes), non-blocking socket:
-EINPROGRESS, -EALREADY, -EISCONN, in that order. Never returns 0.
(2) SIGALRM, set for 1 second, (and reschedules another for 1 second),
non-blocking
-EINPROGRESS, -EALREADY, -EISCONN, in that order. We note that in
-EALREADY a signal is processed. That is the SIGALRM handler.
(3) SIGALRM, blocking:
will run sighandler but connect() returns 0 once, running connect()
again gives EISCONN.
Is that what you expected?
>
> > On Linux (v 2.4.18):
> >
> > read() returns 0 with an errno of 115. On Linux 115 corresponds to
> > -EINPROGRESS.
>
> I am sorry, this machine is not running Linux.
>
> Zero length read() always returns zero, not depending of socket state.
>
>
It doesn't seem to be standardized what one should return.
So read() / write() is not a portable way to test if a socket has been
connected with non-blocking connect.
-- G.
next prev parent reply other threads:[~2002-08-13 5:37 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-10 10:24 [PATCH] connect() return value Geoffrey Lee
2002-08-11 20:46 ` kuznet
2002-08-11 23:25 ` Geoffrey Lee
2002-08-12 1:28 ` kuznet
2002-08-13 2:21 ` Geoffrey Lee
2002-08-13 4:44 ` kuznet
2002-08-13 5:37 ` Geoffrey Lee [this message]
2002-08-13 10:17 ` kuznet
2002-08-13 11:34 ` Geoffrey Lee
2002-08-13 13:47 ` kuznet
2002-08-13 14:32 ` Geoffrey Lee
2002-08-13 15:28 ` kuznet
2002-08-13 23:51 ` Geoffrey Lee
2002-08-14 0:36 ` kuznet
2002-08-14 3:02 ` Geoffrey Lee
2002-08-14 4:16 ` kuznet
2002-08-14 4:57 ` Geoffrey Lee
2002-08-14 17:25 ` kuznet
2002-08-15 3:25 ` glee
2002-08-15 3:15 ` David S. Miller
2002-08-15 11:02 ` Geoffrey Lee
2002-08-15 21:23 ` David S. Miller
2002-08-16 1:08 ` Geoffrey Lee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020813053704.GA14788@anakin.wychk.org \
--to=glee@gnupilgrims.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).