Re: TCP connect in Non Blocking Mode
- From: David Schwartz <davids@xxxxxxxxxxxxx>
- Date: Mon, 28 Apr 2008 09:34:41 -0700 (PDT)
Alan McKenney wrote:
Is it or is it not necessary to set the bit in readset if you
want
select to return immediately on "connection refused"? (This
was the point of the OP.)
Of course not.
At first I thought the answer was "yes", but then people called
it "cargo cult programming", which implies "no." So now
I'm confused.
Why would you think the answer would be yes? If the connection
succeeds, a write will not block. So selecting for writability will
detect this case. If the connection fails, a write will not block. So
selecting for writability will detect this case.
I can think of 3 possible answers:
1. It is necessary. In that case, it is _not_ useless, unless
for
some reason you would rather wait the 30 seconds
to get the connection refused error.
Nope.
2. It is not necessary, the bit in writeset is enough. If so,
we of the great unwashed would like to know what was
wrong with the OP's program.
Nothing is wrong with the OP's program at the top of this thread.
3. It is not necessary, you need to do Y. If so,
please tell us Y.
Arguing about who is doing "cargo cult programming" may
make you feel wise, but it is just confusing for those of
us who don't already know all the anwers.
He has said that selecting for readability is cargo cult programming.
It is being done for no good reason, as some kind of magic charm
that's supposed to make some uncomprehended bug go away.
The reason he wasn't detecting a connection error was already fixed
when he posted this thread. That's why he says, in the first post,
that it's now working.
DS
.
- Follow-Ups:
- Re: TCP connect in Non Blocking Mode
- From: Alex Fraser
- Re: TCP connect in Non Blocking Mode
- References:
- TCP connect in Non Blocking Mode
- From: Prabhu
- Re: TCP connect in Non Blocking Mode
- From: Rainer Temme
- Re: TCP connect in Non Blocking Mode
- From: David Schwartz
- Re: TCP connect in Non Blocking Mode
- From: Rainer Temme
- Re: TCP connect in Non Blocking Mode
- From: David Schwartz
- Re: TCP connect in Non Blocking Mode
- From: Rainer Temme
- Re: TCP connect in Non Blocking Mode
- From: Rainer Weikusat
- Re: TCP connect in Non Blocking Mode
- From: Alex Fraser
- Re: TCP connect in Non Blocking Mode
- From: Rainer Weikusat
- Re: TCP connect in Non Blocking Mode
- From: David Schwartz
- Re: TCP connect in Non Blocking Mode
- From: Alan McKenney
- TCP connect in Non Blocking Mode
- Prev by Date: Re: TCP connect in Non Blocking Mode
- Next by Date: Re: sharing memory map between processes (same parent)
- Previous by thread: Re: TCP connect in Non Blocking Mode
- Next by thread: Re: TCP connect in Non Blocking Mode
- Index(es):
Relevant Pages
|