Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

A list is only as strong as its weakest link. -- Don Knuth


devel / comp.lang.c / [partiallo off topic] on sockets - and how it should be done

SubjectAuthor
* [partiallo off topic] on sockets - and how it should be donefir
+* Re: [partiallo off topic] on sockets - and how it should be doneSpiros Bousbouras
|`* Re: [partiallo off topic] on sockets - and how it should be donefir
| `- Re: [partiallo off topic] on sockets - and how it should be doneKeith Thompson
`- Re: [partiallo off topic] on sockets - and how it should be doneLawrence D'Oliveiro

1
[partiallo off topic] on sockets - and how it should be done

<uq11e4$1uh0o$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=32796&group=comp.lang.c#32796

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: [partiallo off topic] on sockets - and how it should be done
Date: Wed, 07 Feb 2024 23:49:14 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <uq11e4$1uh0o$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 7 Feb 2024 22:49:41 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="2049048"; mail-complaints-to="usenet@i2pn2.org";
posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0";
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: fir - Wed, 7 Feb 2024 22:49 UTC

[i know its somewhat og topic ass it is not on language but
it is on programming in c so imo such things are on topic too]

i never got time/opportunity to learn networking (in last years
i almost no code, tryin to do something more on say 'literature'
with not much result)

hovver i recently decided to maybe understand sockets a bit,
so maybe someone will explain it a bit to me

im not sure but as i understend crucial is send and recv commends
and both are blocking (?)

working with such blocking comends is totally silly imo and it must
be mayeb soem artifact of old ages as its total nonsense (as it
blocks two machines)

as its nonesense the right way would be using non blocking send and recv
but it yeilds to
1) could someone write to me (may be in pseudocode) how to muke such
non blocking commands
2) it this worx nonblocking i quess that network devise or maybe
its driver must queue incomoing packets - so the send and recv
would not block but just put and get things in queue (and that is
right thing imo) - but the question is ..it there some knowledge
on how those queues are, lika capacity and legel assumptions to
get on them, etc?

i think if nonblocking send/recv are right way those queues importance
is crucial and i would like to understand it

tnx, fir (first tme on some newsreader)

Re: [partiallo off topic] on sockets - and how it should be done

<lWU4hdqQzxPvusacM@bongo-ra.co>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=32801&group=comp.lang.c#32801

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: spi...@gmail.com (Spiros Bousbouras)
Newsgroups: comp.lang.c
Subject: Re: [partiallo off topic] on sockets - and how it should be done
Date: Wed, 7 Feb 2024 23:25:27 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 55
Message-ID: <lWU4hdqQzxPvusacM@bongo-ra.co>
References: <uq11e4$1uh0o$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 7 Feb 2024 23:25:27 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2f52725f7ab632db4d1225907b110523";
logging-data="1728779"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/+rsDQw62uiToF1ZwWiqCp"
Cancel-Lock: sha1:PtTvVrBXba/zBH5UCMI/SyLI0Tc=
X-Organisation: Weyland-Yutani
In-Reply-To: <uq11e4$1uh0o$1@i2pn2.org>
X-Server-Commands: nowebcancel
 by: Spiros Bousbouras - Wed, 7 Feb 2024 23:25 UTC

On Wed, 07 Feb 2024 23:49:14 +0100
fir <fir@grunge.pl> wrote:
> [i know its somewhat og topic ass it is not on language but
> it is on programming in c so imo such things are on topic too]

No they aren't. A huge variety of different stuff are programmed in C. If we
tried to discuss all of them here , it would be chaotic.

What you're really asking in non blocking I/O. This is operating system
specific. For Unix/Linux the right place is comp.unix.programmer .But I
think you are on Windows. I don't know what is the Windows analog for
comp.unix.programmer .Perhaps someone else does.

> i never got time/opportunity to learn networking (in last years
> i almost no code, tryin to do something more on say 'literature'
> with not much result)
>
> hovver i recently decided to maybe understand sockets a bit,
> so maybe someone will explain it a bit to me

You can start with https://en.wikipedia.org/wiki/Network_socket .

> im not sure but as i understend crucial is send and recv commends
> and both are blocking (?)
>
> working with such blocking comends is totally silly imo and it must
> be mayeb soem artifact of old ages as its total nonsense (as it
> blocks two machines)
>
> as its nonesense the right way would be using non blocking send and recv
> but it yeilds to
> 1) could someone write to me (may be in pseudocode) how to muke such
> non blocking commands

If you want pseudocode (i.e. more abstract than operating system specific)
then you want comp.programming .

> 2) it this worx nonblocking i quess that network devise or maybe
> its driver must queue incomoing packets - so the send and recv
> would not block but just put and get things in queue (and that is
> right thing imo) - but the question is ..it there some knowledge
> on how those queues are, lika capacity and legel assumptions to
> get on them, etc?
>
> i think if nonblocking send/recv are right way those queues importance
> is crucial and i would like to understand it
>
> tnx, fir (first tme on some newsreader)

Congratulations.

--
Caveat Emptor: The cost of software maintenance increases with the
square of the programmer's creativity.
First Law of Programmer Creativity, Robert D. Bliss, 1992

Re: [partiallo off topic] on sockets - and how it should be done

<uq14of$1ulfl$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=32803&group=comp.lang.c#32803

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: [partiallo off topic] on sockets - and how it should be done
Date: Thu, 08 Feb 2024 00:46:24 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <uq14of$1ulfl$1@i2pn2.org>
References: <uq11e4$1uh0o$1@i2pn2.org> <lWU4hdqQzxPvusacM@bongo-ra.co>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 7 Feb 2024 23:46:24 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="2053621"; mail-complaints-to="usenet@i2pn2.org";
posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0";
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
X-Spam-Checker-Version: SpamAssassin 4.0.0
In-Reply-To: <lWU4hdqQzxPvusacM@bongo-ra.co>
 by: fir - Wed, 7 Feb 2024 23:46 UTC

Spiros Bousbouras wrote:
> On Wed, 07 Feb 2024 23:49:14 +0100
> fir <fir@grunge.pl> wrote:
>> [i know its somewhat og topic ass it is not on language but
>> it is on programming in c so imo such things are on topic too]
>
> No they aren't. A huge variety of different stuff are programmed in C. If we
> tried to discuss all of them here , it would be chaotic.
>

it could be chaotic but it also be not chaotic so generally the answer
is nor no nor yes some like "yesno" and maybe it is better to be open on
yesno themes

as to this sockets i think that this 'queue' of packets must be a
crucial thing here

without it its probably not possible (or nearly) to do such network
communication based on packets and if so the details of it would be
also very important i guess

> What you're really asking in non blocking I/O. This is operating system
> specific. For Unix/Linux the right place is comp.unix.programmer .But I
> think you are on Windows. I don't know what is the Windows analog for
> comp.unix.programmer .Perhaps someone else does.
>
>> i never got time/opportunity to learn networking (in last years
>> i almost no code, tryin to do something more on say 'literature'
>> with not much result)
>>
>> hovver i recently decided to maybe understand sockets a bit,
>> so maybe someone will explain it a bit to me
>
> You can start with https://en.wikipedia.org/wiki/Network_socket .
>
>> im not sure but as i understend crucial is send and recv commends
>> and both are blocking (?)
>>
>> working with such blocking comends is totally silly imo and it must
>> be mayeb soem artifact of old ages as its total nonsense (as it
>> blocks two machines)
>>
>> as its nonesense the right way would be using non blocking send and recv
>> but it yeilds to
>> 1) could someone write to me (may be in pseudocode) how to muke such
>> non blocking commands
>
> If you want pseudocode (i.e. more abstract than operating system specific)
> then you want comp.programming .
>
>> 2) it this worx nonblocking i quess that network devise or maybe
>> its driver must queue incomoing packets - so the send and recv
>> would not block but just put and get things in queue (and that is
>> right thing imo) - but the question is ..it there some knowledge
>> on how those queues are, lika capacity and legel assumptions to
>> get on them, etc?
>>
>> i think if nonblocking send/recv are right way those queues importance
>> is crucial and i would like to understand it
>>
>> tnx, fir (first tme on some newsreader)
>
> Congratulations.
>

Re: [partiallo off topic] on sockets - and how it should be done

<uq14v5$1kr8u$3@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=32804&group=comp.lang.c#32804

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: [partiallo off topic] on sockets - and how it should be done
Date: Wed, 7 Feb 2024 23:49:58 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <uq14v5$1kr8u$3@dont-email.me>
References: <uq11e4$1uh0o$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 7 Feb 2024 23:49:58 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5894b09826b61230d924acc4bad71243";
logging-data="1731870"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18gsBOCekfS38MtYQC8PU69"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:iNmYWNTsUfV1ohcm7J3/7dAloNo=
 by: Lawrence D'Oliv - Wed, 7 Feb 2024 23:49 UTC

On Wed, 07 Feb 2024 23:49:14 +0100, fir wrote:

> im not sure but as i understend crucial is send and recv commends and
> both are blocking (?)

Correct--by default, anyway. It is possible to set O_NONBLOCK on them
<manpages.debian.org/7/socket.en.html>. But then you just get EAGAIN
errors when trying to read or write. Assuming you don’t want to sit in a
CPU-bound polling loop, the easiest way to monitor multiple sources of
events concurrently is with a call like poll(2)
<manpages.debian.org/2/poll.en.html>.

There is also the option of using multiple threads, each blocking on a
single socket, with some IPC scheme to coordinate between them. But that
gets complicated, and prone to heisenbugs.

Re: [partiallo off topic] on sockets - and how it should be done

<87o7crhkb4.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=32808&group=comp.lang.c#32808

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: [partiallo off topic] on sockets - and how it should be done
Date: Wed, 07 Feb 2024 16:27:27 -0800
Organization: None to speak of
Lines: 24
Message-ID: <87o7crhkb4.fsf@nosuchdomain.example.com>
References: <uq11e4$1uh0o$1@i2pn2.org> <lWU4hdqQzxPvusacM@bongo-ra.co>
<uq14of$1ulfl$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="93a22936c47851e9e74d3b604d07c7bb";
logging-data="1744272"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Cd+xRwzBtPgNj/8aEbqNd"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:HKvGw3HTcck2qrsMEf2O0LMIiUo=
sha1:RUuKAFBlG5F/zQxwzUwVHD+V87w=
 by: Keith Thompson - Thu, 8 Feb 2024 00:27 UTC

fir <fir@grunge.pl> writes:
> Spiros Bousbouras wrote:
>> On Wed, 07 Feb 2024 23:49:14 +0100
>> fir <fir@grunge.pl> wrote:
>>> [i know its somewhat og topic ass it is not on language but
>>> it is on programming in c so imo such things are on topic too]
>>
>> No they aren't. A huge variety of different stuff are programmed in C. If we
>> tried to discuss all of them here , it would be chaotic.
>>
>
> it could be chaotic but it also be not chaotic so generally the answer
> is nor no nor yes some like "yesno" and maybe it is better to be open
> on yesno themes
[...]

You're more likely to find people who can answer your questions in
comp.unix.programmer or (I think) comp.os.ms-windows.programmer.win32,
depending on your environment.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor