Article View: alt.comp.lang.rust
Article #457Re: “The end of software secrecy is almost upon us”
From: Lawrence D’Oliveiro
Date: Sat, 31 Oct 2026 05:37
Date: Sat, 31 Oct 2026 05:37
32 lines
3368 bytes
3368 bytes
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.
Technical Details
Message-ID:
<11c3uqi$rrul$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<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>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Lawrence D’Oliveiro <ldo@nz.invalid> Newsgroups: comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers Subject: Re: “The end of software secrecy is almost upon us” Date: Sat, 31 Oct 2026 05:37:23 -0000 (UTC) Organization: A noiseless patient Spider Lines: 32 Message-ID: <11c3uqi$rrul$1@dont-email.me> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Sat, 31 Oct 2026 05:37:23 +0000 (UTC) Injection-Info: dont-email.me; logging-data="913365"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18pXh3KRRRhvpxkDbohgNUr"; posting-host="5b532d3ce1b421f04e3fb32adcf311fc" User-Agent: Pan/0.165 (Kostiantynivka) Cancel-Lock: sha1:2AeEXQY2h4bTiKdG06nDdHNDTbg= sha256:w6Yf8CB7UXHwp7bUhuP0TLXbAV40GMxEvY4dvNOhMyU= sha1:PM0QEEFG/DlT49DAfs/Y6OV740c= sha256:wEfKgBSSUhyEpEABOJFOdEg2IlyU+ueaAiQT7o4P0WI=