🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.rust
Article #468

Re: “The end of software secrecy is almost upon us”

#468
From: Charlie Gibbs
Date: Sun, 01 Nov 2026 19:40
45 lines
3649 bytes
On 2026-10-31, Lawrence D’Oliveiro <ldo@nz.invalid> wrote:

> On Sat, 31 Oct 2026 04:14:05 GMT, Charlie Gibbs wrote:
>
>> I've always tried to avoid the complexities of threading; in most
>> cases I can get away with round-robin scheduling. But I found that
>> some servers are very slow to respond, and even when trying to do a
>> non-blocking setup of a TCP/IP connection, the connect() API would
>> unavoidably block. I had to spin that part off into its own thread
>> to keep the rest of the program (including other connections) from
>> hanging.
>
> Here’s a fun little thing: if you set a socket to nonblocking and then
> do the connect(2) call, it will seemingly fail with an EINPROGRESS
> error. But in fact, the connection attempt gets initiated, and you can
> monitor its subsequent progress from your event loop.
>
> From the ERRORS section of <https://manpages.debian.org/connect(2)>:
>
>     EINPROGRESS
>         The socket is nonblocking and the connection cannot be
>         completed immediately. (UNIX domain sockets failed with EAGAIN
>         instead.) It is possible to select(2) or poll(2) for
>         completion by selecting the socket for writing. After
>         select(2) indicates writability, use getsockopt(2) to read the
>         SO_ERROR option at level SOL_SOCKET to determine whether
>         connect() completed successfully (SO_ERROR is zero) or
>         unsuccessfully (SO_ERROR is one of the usual error codes
>         listed here, explaining the reason for the failure).
>
> I’m not sure about doing this sort of thing from other libraries that
> wrap socket connections (e.g. SSL/TLS libraries); for these, the usual
> fallback is still available, as you say, by turning a blocking call
> into a nonblocking one by pushing it off to a separate thread.

I was already setting the socket to non-blocking before calling
connect() - and yet there were times when the API blocked anyway.
I never did figure out why, and we had a customer getting impatient,
so I just spun off another thread and moved on to other things.

-- 
/~\  Charlie Gibbs                  |  In this world there are
\ /  <cgibbs@kltpzyxm.invalid>      |  two kinds of people:
 X   I'm really at ac.dekanfrus     |  1. Those who can extrapolate
/ \  if you read it the right way.  |  from incomplete data.
Technical Details
Message-ID: <sAMFS.70974$%ZO1.16046@fx13.iad>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx13.iad.POSTED!not-for-mail
References: <11amvre$15far$1@dont-email.me> <20261030005434.00005458@yahoo.com> <11c0v1j$her$1@reader2.panix.com> <20261030105900.000020ce@yahoo.com> <11c1uqd$keq$1@reader2.panix.com> <11c2fcl$19bk2$1@dont-email.me> <11c2rla$hko3$2@dont-email.me> <11c362o$lfc1$1@dont-email.me> <hWdFS.111353$cLL5.22363@fx42.iad> <11c3uqi$rrul$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx13.iad.POSTED!not-for-mail
Newsgroups: comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers
From: Charlie Gibbs <cgibbs@kltpzyxm.invalid>
Subject: Re: “The end of software secrecy is almost upon
 us”
References: <11amvre$15far$1@dont-email.me>
 <20261030005434.00005458@yahoo.com> <11c0v1j$her$1@reader2.panix.com>
 <20261030105900.000020ce@yahoo.com> <11c1uqd$keq$1@reader2.panix.com>
 <11c2fcl$19bk2$1@dont-email.me> <11c2rla$hko3$2@dont-email.me>
 <11c362o$lfc1$1@dont-email.me> <hWdFS.111353$cLL5.22363@fx42.iad>
 <11c3uqi$rrul$1@dont-email.me>
User-Agent: slrn/1.0.3 (Linux)
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Lines: 45
Message-ID: <sAMFS.70974$%ZO1.16046@fx13.iad>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Sun, 01 Nov 2026 19:40:08 UTC
Date: Sun, 01 Nov 2026 19:40:08 GMT
X-Received-Bytes: 3335