🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.fortran
Article #481

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

#481
From: Chris M. Thomasson
Date: Mon, 02 Nov 2026 23:06
49 lines
4133 bytes
On 11/1/2026 11:40 AM, Charlie Gibbs wrote:
> 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.
> 

connect? On Windows we use ConnectEx.

https://learn.microsoft.com/en-us/windows/win32/api/mswsock/nc-mswsock-lpfn_connectex

For accept, AcceptEx:

https://learn.microsoft.com/en-us/windows/win32/api/mswsock/nf-mswsock-acceptex
Technical Details
Message-ID: <11cb51b$3a1ce$5@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-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> <sAMFS.70974$%ZO1.16046@fx13.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: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
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: Mon, 2 Nov 2026 15:06:18 -0800
Organization: A noiseless patient Spider
Lines: 49
Message-ID: <11cb51b$3a1ce$5@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>
 <11c3uqi$rrul$1@dont-email.me> <sAMFS.70974$%ZO1.16046@fx13.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 02 Nov 2026 23:06:20 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3474830"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19TjH2xeIpqzKIgaDfAnQBWPsti5CoJZvc="; posting-host="fd80377b988fc8508b7c14d1178ed880"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Nwg01HH6M2/+R0WIu8nMme3kjuU= sha256:MMHTn55bMshEVL3D35c9nMAMIBBsyIyESSrY0i4Q1QY=
	sha1:NOQEF2SiKxypo67aNaIWaWs8rdo= sha256:MTMQm/UfSy2CrhGqQtW7DXFUJMVfjlkFrGgZxHjWy+g=
In-Reply-To: <sAMFS.70974$%ZO1.16046@fx13.iad>
Content-Language: en-US