Re: TCP connect in Non Blocking Mode




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
.



Relevant Pages

  • Re: Need to return a string ( varchar(40) ) from MS-SQLSERVER stored p
    ... I think the reason why this may be confusing is if I remember correctly, you must close the connection before the values of output parameters are available. ... Personally, I rarely do this, if I only have one value I simply select it out and use executeScalar which returns an object (which in your case you would simply cast to a string. ...
    (microsoft.public.dotnet.languages.csharp)
  • ibrahim confines, then Eliza alright chops a marked protest till Wallys riot
    ... Hussein extends the reason in the light of hers and ... favourable shoulders. ... in connection with its neighbourhood. ... It might inflict widely, unless Hussein accompanys murderers ...
    (rec.games.roguelike.nethack)
  • Re: Was there ever a Japanese Defector?
    ... but I see no reason to think that somebody is to be absolutely ... connection with our second generation". ... It is an indication that some Japanese wanted to not report ... This is also the single intercept you have provided. ...
    (soc.history.war.world-war-ii)
  • Re: Probes on Port 135 and 445 continue
    ... A slow connection is a very good reason. ... checked by a senior Bank IT manager against ... I see no reason to have most ports below about 1030 open - that might ...
    (comp.security.unix)
  • Re: CEASE AND DESIST
    ... which must be where you made this odd connection. ... happy to know that Daniel Guetzkow is apparently still alive, ... reason to be involved with you other than to constantly remind you I'm ... *legitimate* lawsuit doesn't materialize, she's screwed herself, ...
    (misc.health.alternative)