• this guy talks about fopen (and im thinking about fopen for network)

    From fir@3:633/10 to All on Mon Jun 8 17:49:03 2026
    https://www.youtube.com/watch?v=XAzUoizwnXM

    i dint watched it whole but it comes to my mind that those socket communication indeed should be probably made using fopen/fread/fwrite/fgetc/fputc

    i was doing only basics of socket programming anver liked it and
    remember almost nothing - it is becouse i dont liek stupid things
    and those sockets looks stupid

    i guess using this fopen it would be much better..

    whot would you need i assume you need to fopen connection to distant machine..not sure if it should be one the same for read write or two
    one for read and one for write..then i think the network card should
    have buffer whete there is stacked incoming data, same for outcoming
    data,a nd thats all as to basics probably..no hanging controll no
    additional threads..just like working with files

    whough additional soft could be written too, based on thai but it should
    be sane thing something based like with working with files (knowing
    those files are ram files and are contents of incoming and outcoming buffer

    thise sockets todajy i dont remember but in my vague mameory it feels
    like shit

    feel free to comment on this topic if you want


    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From fir@3:633/10 to All on Mon Jun 8 18:16:10 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    fir pisze:
    https://www.youtube.com/watch?v=XAzUoizwnXM

    i dint watched it whole but it comes to my mind that those socket communication indeed should be probably made using fopen/fread/fwrite/fgetc/fputc

    i was doing only basics of socket programming anver liked it and
    remember almost nothing - it is becouse i dont liek stupid things
    and those sockets looks stupid

    i guess using this fopen it would be much better..

    whot would you need i assume you need to fopen connection to distant machine..not sure if it should be one the same for read write or two
    one for read and one for write..then i think the network card should
    have buffer whete there is stacked incoming data, same for outcoming
    data,a nd thats all as to basics probably..no hanging controll no
    additional threads..just like working with files

    whough additional soft could be written too, based on thai but it should
    be sane thing something based like with working with files (knowing
    those files are ram files and are contents of incoming and outcoming buffer

    thise sockets todajy i dont remember but in my vague mameory it feels
    like shit

    feel free to comment on this topic if you want

    maybe someone who has some experience with socked programming know how
    the basic communication would look like using this fopen scheme

    main()

    {
    FILE* f = fopen("1.2.3.4:555");

    fprintf(f, "hello there\n"); fflush(f);

    for(int i=0; i<100; i++)
    {
    static char buf[4096];
    if(fgets(buf, sizeof(buf), f))
    printf("incoming: %s", buf);

    Sleep(100); //wait 100 ms



    }


    }
    something like that?

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From fir@3:633/10 to All on Mon Jun 8 18:24:06 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    fir pisze:
    fir pisze:
    https://www.youtube.com/watch?v=XAzUoizwnXM

    i dint watched it whole but it comes to my mind that those socket
    communication indeed should be probably made using
    fopen/fread/fwrite/fgetc/fputc

    i was doing only basics of socket programming anver liked it and
    remember almost nothing - it is becouse i dont liek stupid things
    and those sockets looks stupid

    i guess using this fopen it would be much better..

    whot would you need i assume you need to fopen connection to distant
    machine..not sure if it should be one the same for read write or two
    one for read and one for write..then i think the network card should
    have buffer whete there is stacked incoming data, same for outcoming
    data,a nd thats all as to basics probably..no hanging controll no
    additional threads..just like working with files

    whough additional soft could be written too, based on thai but it
    should be sane thing something based like with working with files
    (knowing those files are ram files and are contents of incoming and
    outcoming buffer

    thise sockets todajy i dont remember but in my vague mameory it feels
    like shit

    feel free to comment on this topic if you want

    maybe someone who has some experience with socked programming know how
    the basic communication would look like using this fopen scheme

    main()

    {
    ˙˙ FILE* f = fopen("1.2.3.4:555");

    ˙ fprintf(f, "hello there\n"); fflush(f);

    ˙ for(int i=0; i<100; i++)
    ˙ {
    ˙˙˙ static char buf[4096];
    ˙˙˙ if(fgets(buf, sizeof(buf), f))
    ˙˙˙˙˙˙ printf("incoming: %s", buf);

    ˙˙˙ Sleep(100); //wait 100 ms



    ˙ }


    }
    something like that?

    that sockets are so shit i maybe could learn imagining how it could more
    look in old c stdlib (still they probably be in stdlib in fact)

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Tue Jun 9 00:26:08 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Mon, 8 Jun 2026 17:49:03 +0200, fir wrote:

    i dint watched it whole but it comes to my mind that those socket communication indeed should be probably made using fopen/fread/fwrite/fgetc/fputc

    On POSIX systems, the actual connection setup is not done by opening
    normal files, but once setup, the result is an fd that can be used
    with many regular fd calls. In particular, for a stream connection,
    you can get by with normal read/write calls for most purposes. And poll(2)/epoll(2) work just fine, of course.

    Plan9 tried to do all network I/O this way -- pretend it?s all just
    file I/O. I don?t think it works all that well.

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Tue Jun 9 00:28:48 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Mon, 8 Jun 2026 18:16:10 +0200, fir wrote:

    Sleep(100); //wait 100 ms

    That?s usually a dumb thing to do. It?s either too slow if something
    comes in/goes out more quickly, or too much overhead if communication
    is slower than that. And it just gets worse if you?re trying to juggle
    multiple connections (as a server commonly does).

    Try using this <https://manpages.debian.org/poll(2)>, at least ...

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From fir@3:633/10 to All on Tue Jun 9 08:56:00 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    Lawrence D?Oliveiro pisze:
    On Mon, 8 Jun 2026 18:16:10 +0200, fir wrote:

    Sleep(100); //wait 100 ms

    That?s usually a dumb thing to do. It?s either too slow if something
    comes in/goes out more quickly, or too much overhead if communication
    is slower than that. And it just gets worse if you?re trying to juggle multiple connections (as a server commonly does).

    Try using this <https://manpages.debian.org/poll(2)>, at least ...


    i will answer more mabe later coz i had some health crisis and if i do i
    cant cofus

    but the topic is sorta interesting to me possibly worth getting in few
    hours or days


    as to "this is domb thing" i dont think so - this topic is about
    architectural simplicity against winsock mess and this is nice
    architectural simplicity

    you know what sleep() function is its extremally often used basic
    windows function which sleeps main thread for n miliseconds, every
    or nearly every (afait) windows app uses it so its totally notmall

    i dont know and i would need to check it but as far as i understood
    network card recives incoming data and stores it in its own buffer
    (its (afait) outside of cpu work, and buffer has some size so maybe if
    you put this sleep as 1 mmilisecond that the buffer of network card
    will not be overfloved... how todays ntwork speeds are - it is more than
    say i GB/s? with 1 ms sleep the incoming data would be 1 MB at this
    speed so its not too much

    ofc thw application do other things than only waiting, it also my update
    frame time (10 -20 ms) but still that simple scenario could work imo

    interesting thing is hovevevr if this network card has its own ram how
    its stores t in more detail (which i dont know) but logically it is
    probably some ram buffer which may be indeed treated as an open file
    and read by fgets/fread etc

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From fir@3:633/10 to All on Tue Jun 9 10:26:13 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    fir pisze:
    Lawrence D?Oliveiro pisze:
    On Mon, 8 Jun 2026 18:16:10 +0200, fir wrote:

    ˙˙˙˙˙ Sleep(100); //wait 100 ms

    That?s usually a dumb thing to do. It?s either too slow if something
    comes in/goes out more quickly, or too much overhead if communication
    is slower than that. And it just gets worse if you?re trying to juggle
    multiple connections (as a server commonly does).

    Try using this <https://manpages.debian.org/poll(2)>, at least ...


    i will answer more mabe later coz i had some health crisis and if i do i cant cofus

    but the topic is sorta interesting to me possibly worth getting in few
    hours or days


    as to "this is domb thing" i dont think so - this topic is about architectural simplicity against winsock mess and this is nice
    architectural simplicity

    you know what sleep() function is its extremally often used basic
    windows function which sleeps main thread for n miliseconds, every
    or nearly every (afait) windows app uses it so its totally notmall

    ˙i dont know and i would need to check it but as far as i understood
    network card recives incoming data and stores it in its own buffer
    (its (afait) outside of cpu work, and buffer has some size so maybe if
    you put this sleep as 1 mmilisecond that the buffer of network card
    will not be overfloved... how todays ntwork speeds are - it is more than
    say i GB/s? with 1 ms sleep the incoming data would be 1 MB at this
    speed so its not too much

    ofc thw application do other things than only waiting, it also my update frame time (10 -20 ms)˙ but still that simple scenario could work imo

    interesting thing is hovevevr if this network card has its own ram how
    its stores t in more detail (which i dont know) but logically it is
    probably some ram buffer which may be indeed treated as an open file
    and read by fgets/fread etc

    ok i slightly talked with ai how it looks like and seems that it is such
    as i thought in cse of TCP (withs some details, ai say that the buffers
    are smaller in network cards and data are passed to kernel level ram
    buffer, which is maybe not so big again but the tcp can stop undil data
    are consumed)

    this sleep scheme is imo ok ..becouse generally if you have no sleep
    you will hang on some event loop and if so this event loop hanging
    internally must have something like sleep wake up mechanism and if
    its internall it means its worse imo (until you eventually know
    externally this mechanisms)...so imo sleep is ok




    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Tue Jun 9 09:10:04 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Tue, 9 Jun 2026 08:56:00 +0200, fir wrote:

    you know what sleep() function is its extremally often used basic
    windows function which sleeps main thread for n miliseconds, every
    or nearly every (afait) windows app uses it so its totally notmall

    Maybe normal in Windows, but in regular multitasking OSes, we have
    these standard techniques for maximizing responsiveness while
    minimizing resource usage. Which is why systems like Linux can scale
    gracefully to tens or even hundreds of thousands of simultaneous peer connections.

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From fir@3:633/10 to All on Tue Jun 9 11:34:36 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    Lawrence D?Oliveiro pisze:
    On Tue, 9 Jun 2026 08:56:00 +0200, fir wrote:

    you know what sleep() function is its extremally often used basic
    windows function which sleeps main thread for n miliseconds, every
    or nearly every (afait) windows app uses it so its totally notmall

    Maybe normal in Windows, but in regular multitasking OSes, we have
    these standard techniques for maximizing responsiveness while
    minimizing resource usage. Which is why systems like Linux can scale gracefully to tens or even hundreds of thousands of simultaneous peer connections.

    this standard techniques are not necesarelly much good imo...ans sleep
    is architecturally simple and not bad imo

    this is also not inneficient - its efficient as it returns power to
    system (somore app uses sleep more lightweight it is i would say)

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Paul@3:633/10 to All on Tue Jun 9 06:02:25 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Tue, 6/9/2026 5:10 AM, Lawrence D?Oliveiro wrote:
    On Tue, 9 Jun 2026 08:56:00 +0200, fir wrote:

    you know what sleep() function is its extremally often used basic
    windows function which sleeps main thread for n miliseconds, every
    or nearly every (afait) windows app uses it so its totally notmall

    Maybe normal in Windows, but in regular multitasking OSes, we have
    these standard techniques for maximizing responsiveness while
    minimizing resource usage. Which is why systems like Linux can scale gracefully to tens or even hundreds of thousands of simultaneous peer connections.


    This isn't particularly a good place to get Windows internals details.

    You can use Sysinternals Process Explorer, run it as administrator,
    and it has a tick counter for processes, such that you can "measure"
    how many CPU clock cycles are used per update of the PE readout.
    Most of the svchost, for example, DON'T USE ANY CYCLES AT ALL.

    A select few svchost are cycle-pigs, and during Windows Update for example,
    you can see one of the svchost is railed. Which is to be expected.
    It's very busy. it has a thousand packages to evaluate.

    I have a power meter on the machine (on the AC plug). I will
    now measure Windows desktop idle power, then boot some Linux
    and compare. Windows is on a 4TB SSD. The four Linux share a 1TB SSD,
    making the test a bit easier to run.

    (All DEs set to the same screen resolution)

    Windows 11 Home - 1920x1080 33.9W Idle
    LMDE7 (cinnamon DE) 40.3W Idle
    Linux Mint 223 Mate 45.7W Idle
    Linux Mint 223 XFCE 46.4W Idle
    Devuan 6 (cinnamon DE w.Nvidia) 34.7W Idle

    Only Devuan 6 with the non-systemd init system and running X11, comes close to Windows 11.

    Paul



    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From fir@3:633/10 to All on Tue Jun 9 12:18:12 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    Paul pisze:
    On Tue, 6/9/2026 5:10 AM, Lawrence D?Oliveiro wrote:
    On Tue, 9 Jun 2026 08:56:00 +0200, fir wrote:

    you know what sleep() function is its extremally often used basic
    windows function which sleeps main thread for n miliseconds, every
    or nearly every (afait) windows app uses it so its totally notmall

    Maybe normal in Windows, but in regular multitasking OSes, we have
    these standard techniques for maximizing responsiveness while
    minimizing resource usage. Which is why systems like Linux can scale
    gracefully to tens or even hundreds of thousands of simultaneous peer
    connections.


    This isn't particularly a good place to get Windows internals details.

    You can use Sysinternals Process Explorer, run it as administrator,
    and it has a tick counter for processes, such that you can "measure"
    how many CPU clock cycles are used per update of the PE readout.
    Most of the svchost, for example, DON'T USE ANY CYCLES AT ALL.

    A select few svchost are cycle-pigs, and during Windows Update for example, you can see one of the svchost is railed. Which is to be expected.
    It's very busy. it has a thousand packages to evaluate.

    I have a power meter on the machine (on the AC plug). I will
    now measure Windows desktop idle power, then boot some Linux
    and compare. Windows is on a 4TB SSD. The four Linux share a 1TB SSD,
    making the test a bit easier to run.

    (All DEs set to the same screen resolution)

    Windows 11 Home - 1920x1080 33.9W Idle
    LMDE7 (cinnamon DE) 40.3W Idle
    Linux Mint 223 Mate 45.7W Idle
    Linux Mint 223 XFCE 46.4W Idle
    Devuan 6 (cinnamon DE w.Nvidia) 34.7W Idle

    Only Devuan 6 with the non-systemd init system and running X11, comes close to Windows 11.

    Paul

    im not sure what about this all is? some try to say that event driven is better than poling? (imo polling is probably generally better)
    (polling is "classical" and easy, by simple sleep (which should be very effective by itself) one can do a lot and the code is clean)

    but what has svchost to it all?


    BTW im rather fan of sleep() but maybe im not much fan of hanging on
    this event queue...imo it would be probably better not have its
    explicitelly but maybe just registering an event handler (one big for
    all events of maybe many specific ones) THOUGH there is also option
    for even not registering handles but indeed just having a raw acces to
    this queue (filled by system) and manage it itself

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From David Brown@3:633/10 to All on Tue Jun 9 12:25:24 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 09/06/2026 11:34, fir wrote:
    Lawrence D?Oliveiro pisze:
    On Tue, 9 Jun 2026 08:56:00 +0200, fir wrote:

    you know what sleep() function is its extremally often used basic
    windows function which sleeps main thread for n miliseconds, every
    or nearly every (afait) windows app uses it so its totally notmall

    Maybe normal in Windows, but in regular multitasking OSes, we have
    these standard techniques for maximizing responsiveness while
    minimizing resource usage. Which is why systems like Linux can scale
    gracefully to tens or even hundreds of thousands of simultaneous peer
    connections.

    this standard techniques are not necesarelly much good imo...ans sleep
    is architecturally simple and not bad imo

    this is also not inneficient - its efficient as it returns power to
    system (somore app uses sleep more lightweight it is i would say)

    Yes. A simple loop with sleep and then checking for new input is not
    scalable when you are doing lots of them at once, such as for a web
    server. But it is perfectly good for small, simple systems or during
    testing and developing, and saves a lot of effort compared to using
    poll(), select(), or other such solutions. It usually doesn't matter if
    the extra wakeups and checks use a couple of percent of cpu time. (It
    does matter, of course, when you have hundreds or thousands of such
    loops on a server.)


    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From fir@3:633/10 to All on Tue Jun 9 12:31:40 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    David Brown pisze:
    On 09/06/2026 11:34, fir wrote:
    Lawrence D?Oliveiro pisze:
    On Tue, 9 Jun 2026 08:56:00 +0200, fir wrote:

    you know what sleep() function is its extremally often used basic
    windows function which sleeps main thread for n miliseconds, every
    or nearly every (afait) windows app uses it so its totally notmall

    Maybe normal in Windows, but in regular multitasking OSes, we have
    these standard techniques for maximizing responsiveness while
    minimizing resource usage. Which is why systems like Linux can scale
    gracefully to tens or even hundreds of thousands of simultaneous peer
    connections.

    this standard techniques are not necesarelly much good imo...ans sleep
    is architecturally simple and not bad imo

    this is also not inneficient - its efficient as it returns power to
    system (somore app uses sleep more lightweight it is i would say)

    Yes.˙ A simple loop with sleep and then checking for new input is not scalable when you are doing lots of them at once, such as for a web
    server.˙ But it is perfectly good for small, simple systems or during testing and developing, and saves a lot of effort compared to using
    poll(), select(), or other such solutions.˙ It usually doesn't matter if
    the extra wakeups and checks use a couple of percent of cpu time.˙ (It
    does matter, of course, when you have hundreds or thousands of such
    loops on a server.)


    im not thinkin on the server..i am talking on most simple architecture
    for reading/writing data via network especially one that can be build
    arounf fopen/fclose and those functions used to read write to files

    at least tcp conection seen can be totally done like that fopen(
    connection) fgets, fputs, fclose() though loop and sleep also need to be invvolved


    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From fir@3:633/10 to All on Tue Jun 9 13:43:53 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    fir pisze:
    David Brown pisze:
    On 09/06/2026 11:34, fir wrote:
    Lawrence D?Oliveiro pisze:
    On Tue, 9 Jun 2026 08:56:00 +0200, fir wrote:

    you know what sleep() function is its extremally often used basic
    windows function which sleeps main thread for n miliseconds, every
    or nearly every (afait) windows app uses it so its totally notmall

    Maybe normal in Windows, but in regular multitasking OSes, we have
    these standard techniques for maximizing responsiveness while
    minimizing resource usage. Which is why systems like Linux can scale
    gracefully to tens or even hundreds of thousands of simultaneous peer
    connections.

    this standard techniques are not necesarelly much good imo...ans
    sleep is architecturally simple and not bad imo

    this is also not inneficient - its efficient as it returns power to
    system (somore app uses sleep more lightweight it is i would say)

    Yes.˙ A simple loop with sleep and then checking for new input is not
    scalable when you are doing lots of them at once, such as for a web
    server.˙ But it is perfectly good for small, simple systems or during
    testing and developing, and saves a lot of effort compared to using
    poll(), select(), or other such solutions.˙ It usually doesn't matter
    if the extra wakeups and checks use a couple of percent of cpu time.
    (It does matter, of course, when you have hundreds or thousands of
    such loops on a server.)


    im not thinkin on the server..i am talking on most simple architecture
    for reading/writing data via network especially one that can be build
    arounf fopen/fclose and those functions used to read write to files

    at least tcp conection seen can be totally done like that fopen(
    connection) fgets, fputs, fclose() though loop and sleep also need to be invvolved

    as to servers though i dont think the situation would be quite different

    you got

    for(;;)
    {
    fread(..., f);
    //do something
    fwrite(..., f);

    sleep(1);
    }

    when you got many conections there is no more loops and sleeps just more
    f's in a loop


    and as server has its limit it must be some entry compter that
    redirects connections to servers if you have hundreds of them

    no? so it seems not much more complex

    i must rethink hovever how exactly it would look like when two
    computers who communicates (and which are like working
    in 50-100 fps mode indeed communicate (but maybe i will do it later)

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From fir@3:633/10 to All on Tue Jun 9 13:53:28 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    fir pisze:
    fir pisze:
    David Brown pisze:
    On 09/06/2026 11:34, fir wrote:
    Lawrence D?Oliveiro pisze:
    On Tue, 9 Jun 2026 08:56:00 +0200, fir wrote:

    you know what sleep() function is its extremally often used basic
    windows function which sleeps main thread for n miliseconds, every >>>>>> or nearly every (afait) windows app uses it so its totally notmall

    Maybe normal in Windows, but in regular multitasking OSes, we have
    these standard techniques for maximizing responsiveness while
    minimizing resource usage. Which is why systems like Linux can scale >>>>> gracefully to tens or even hundreds of thousands of simultaneous peer >>>>> connections.

    this standard techniques are not necesarelly much good imo...ans
    sleep is architecturally simple and not bad imo

    this is also not inneficient - its efficient as it returns power to
    system (somore app uses sleep more lightweight it is i would say)

    Yes.˙ A simple loop with sleep and then checking for new input is not
    scalable when you are doing lots of them at once, such as for a web
    server.˙ But it is perfectly good for small, simple systems or during
    testing and developing, and saves a lot of effort compared to using
    poll(), select(), or other such solutions.˙ It usually doesn't matter
    if the extra wakeups and checks use a couple of percent of cpu time.
    (It does matter, of course, when you have hundreds or thousands of
    such loops on a server.)


    im not thinkin on the server..i am talking on most simple architecture
    for reading/writing data via network especially one that can be build
    arounf fopen/fclose and those functions used to read write to files

    at least tcp conection seen can be totally done like that fopen(
    connection) fgets, fputs, fclose() though loop and sleep also need to
    be invvolved

    as to servers though i dont think the situation would be quite different

    you got

    ˙for(;;)
    ˙{
    ˙˙˙˙ fread(..., f);
    ˙˙˙˙ //do something
    ˙˙˙˙ fwrite(..., f);

    ˙˙˙˙ sleep(1);
    ˙}

    when you got many conections there is no more loops and sleeps just more
    f's in a loop


    and as server has its limit it must be some entry compter that
    redirects connections to servers if you have hundreds of them

    no? so it seems not much more complex

    i must rethink hovever how exactly it would look like when two
    computers who communicates (and which are like working
    in 50-100 fps mode indeed communicate (but maybe i will do it later)

    sad nevs ai says that TCP not guarantees that whole pack would be
    received and it can be only part... so it complicates code using it a bit

    othervvise it could be i think

    game_loop()
    {
    if(frame_number>0)
    receive_enemy_state(); //in first frame we only send (?)

    //game mechanic

    send_player_state();

    draw_frame();
    sleep(10);

    }

    where those receive_enemy_state/send_player_state are simple functions
    based on some fread/fwrite

    imo its generally gard to write apps with a lot of error handling
    mechanic so it would be better to keep it simple (and how error hendling mechanic it would need i dont know yet)

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Tue Jun 9 13:54:51 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/8/2026 5:28 PM, Lawrence D?Oliveiro wrote:
    On Mon, 8 Jun 2026 18:16:10 +0200, fir wrote:

    Sleep(100); //wait 100 ms

    That?s usually a dumb thing to do. It?s either too slow if something
    comes in/goes out more quickly, or too much overhead if communication
    is slower than that. And it just gets worse if you?re trying to juggle multiple connections (as a server commonly does).

    Try using this <https://manpages.debian.org/poll(2)>, at least ...

    ir_uring? ;^)

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Tue Jun 9 13:55:25 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/9/2026 2:10 AM, Lawrence D?Oliveiro wrote:
    On Tue, 9 Jun 2026 08:56:00 +0200, fir wrote:

    you know what sleep() function is its extremally often used basic
    windows function which sleeps main thread for n miliseconds, every
    or nearly every (afait) windows app uses it so its totally notmall

    Maybe normal in Windows, but in regular multitasking OSes, we have
    these standard techniques for maximizing responsiveness while
    minimizing resource usage. Which is why systems like Linux can scale gracefully to tens or even hundreds of thousands of simultaneous peer connections.

    Well, for servers/clients in windows, IOCP is key.

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Kaz Kylheku@3:633/10 to All on Tue Jun 9 21:21:49 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 2026-06-08, fir <profesor.fir@gmail.com> wrote:
    https://www.youtube.com/watch?v=XAzUoizwnXM

    i dint watched it whole but it comes to my mind that those socket communication indeed should be probably made using fopen/fread/fwrite/fgetc/fputc

    That's how it is in the Plan 9 operating system. It takes the
    "everything is a file" paradigm that Unix started on. Unix diverged
    from that paradigm in implementing new things like networking.


    i was doing only basics of socket programming anver liked it and
    remember almost nothing - it is becouse i dont liek stupid things
    and those sockets looks stupid

    i guess using this fopen it would be much better..

    "Using fopen" is better is basically "using strings is better"
    in disguise. When you use fopen to open a network client or server
    connection, all the connection parameters have to be encoded into
    a character string, instead of binary structures.

    That makes some things easy, such as binding to networking from a new programming language (no "FFI" required, just buffered file I/O and
    string munging).

    The strings are inefficient, though; they have to be formatted
    and parsed. They lack type safety. You can put wrong values
    into a binary address structure, but in a string you can cause
    a syntax error. And worse, injection security holes and whatnot.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Tue Jun 9 23:45:50 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Tue, 9 Jun 2026 06:02:25 -0400, Paul wrote:

    A select few svchost are cycle-pigs, and during Windows Update for
    example, you can see one of the svchost is railed. Which is to be
    expected. It's very busy. it has a thousand packages to evaluate.

    It has long been known that the Windows update process is very
    inefficient, for some reason <https://www.tomshardware.com/news/windows-update-needs-eight-hours>.

    I have more than a thousand? packages installed on my main Linux
    system, and it can still evaluate all the updates needed in just a
    few minutes.

    ?The command ?dpkg-query -l | grep -c ^i? reports a count of 5503.

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Tue Jun 9 23:47:26 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Tue, 9 Jun 2026 13:54:51 -0700, Chris M. Thomasson wrote:

    ir_uring? ;^)

    io_uring, you mean?

    That, too, is a possibility, for even higher performance.

    <https://manpages.debian.org/io_uring(7)>

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Tue Jun 9 23:56:25 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Tue, 9 Jun 2026 13:55:25 -0700, Chris M. Thomasson wrote:

    On 6/9/2026 2:10 AM, Lawrence D?Oliveiro wrote:

    ... in regular multitasking OSes, we have these standard techniques
    for maximizing responsiveness while minimizing resource usage.
    Which is why systems like Linux can scale gracefully to tens or
    even hundreds of thousands of simultaneous peer connections.

    Well, for servers/clients in windows, IOCP is key.

    IOCP is based on the asynchronous I/O model from DEC?s old VMS
    operating system, which Dave Cutler also masterminded before moving to Microsoft to create Windows NT.

    Nobody else seems to have thought it a worthwhile enough model to
    copy, though. I think it requires you to have multiple I/O requests in
    flight, one for each connection you want to watch. This might make for
    a more complicated programming model, as opposed to the simplicity of poll(2)/epoll(2).

    The most critical known test of Windows Server performance was
    probably the London Stock Exchange fiasco. After crowing about winning
    the contract ahead of Linux-based competitors, Microsoft had to eat
    humble pie after the whole setup fell flat on its face.

    And was replaced with a Linux-based alternative.

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Wed Jun 10 00:00:50 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Tue, 9 Jun 2026 11:34:36 +0200, fir wrote:

    Lawrence D?Oliveiro pisze:

    On Tue, 9 Jun 2026 08:56:00 +0200, fir wrote:

    you know what sleep() function is its extremally often used basic
    windows function which sleeps main thread for n miliseconds, every
    or nearly every (afait) windows app uses it so its totally notmall

    Maybe normal in Windows, but in regular multitasking OSes, we have
    these standard techniques for maximizing responsiveness while
    minimizing resource usage. Which is why systems like Linux can
    scale gracefully to tens or even hundreds of thousands of
    simultaneous peer connections.

    this standard techniques are not necesarelly much good imo...ans
    sleep is architecturally simple and not bad imo

    You keep saying that, even after I point out why it?s a bad idea.

    this is also not inneficient - its efficient as it returns power to
    system (somore app uses sleep more lightweight it is i would say)

    Think of how you could do enough peak throughput to saturate a gigabit
    Ethernet link. This is at the low end of network connection speeds
    these days -- higher-performance configurations might have an order of magnitude or two greater bandwidth.

    To manage it, you?d need to push through about 120 megabytes per
    second. With your sleep-every-100ms poll, this means each I/O request
    would need a buffer size of about 12 megabytes. This is ridiculously
    large. And of course the 100ms latency would be unacceptable for many
    uses -- think of a multiuser game server, for example.

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Wed Jun 10 00:02:17 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Tue, 9 Jun 2026 13:53:28 +0200, fir wrote:

    sad nevs ai says that TCP not guarantees that whole pack would be
    received and it can be only part... so it complicates code using it
    a bit

    Why? Surely you would not try to handle an incoming request or
    response until you were sure you had received the whole thing,
    wouldn?t you?

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Tue Jun 9 21:42:58 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/9/2026 4:47 PM, Lawrence D?Oliveiro wrote:
    On Tue, 9 Jun 2026 13:54:51 -0700, Chris M. Thomasson wrote:

    ir_uring? ;^)

    io_uring, you mean?

    DOH!



    That, too, is a possibility, for even higher performance.

    <https://manpages.debian.org/io_uring(7)>

    Oh I think so.

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Tue Jun 9 21:52:39 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/9/2026 4:56 PM, Lawrence D?Oliveiro wrote:
    On Tue, 9 Jun 2026 13:55:25 -0700, Chris M. Thomasson wrote:

    On 6/9/2026 2:10 AM, Lawrence D?Oliveiro wrote:

    ... in regular multitasking OSes, we have these standard techniques
    for maximizing responsiveness while minimizing resource usage.
    Which is why systems like Linux can scale gracefully to tens or
    even hundreds of thousands of simultaneous peer connections.

    Well, for servers/clients in windows, IOCP is key.

    IOCP is based on the asynchronous I/O model from DEC?s old VMS
    operating system, which Dave Cutler also masterminded before moving to Microsoft to create Windows NT.

    Nobody else seems to have thought it a worthwhile enough model to
    copy, though. I think it requires you to have multiple I/O requests in flight, one for each connection you want to watch. This might make for
    a more complicated programming model, as opposed to the simplicity of poll(2)/epoll(2).



    The most critical known test of Windows Server performance was
    probably the London Stock Exchange fiasco. After crowing about winning
    the contract ahead of Linux-based competitors, Microsoft had to eat
    humble pie after the whole setup fell flat on its face.

    And was replaced with a Linux-based alternative.

    IOCP is the way to go on Windows. Fwiw, I used it quite a bit around 25+
    years ago back on Windows NT 4.0 Then GQCSEX came out:

    https://learn.microsoft.com/en-us/windows/win32/fileio/getqueuedcompletionstatusex-func

    That is a fun one that returns more than one completion request.

    However, you have to know how to use it correctly! For instance, I would gather the io completions and sort them as usually wsasends, wsarecvs, acceptex, connectex, ect into separate per thread stacks. Then execute
    them in batches sometimes on another thread pool. I remember an old
    paper, cohort scheduling.

    https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/tr-2001-39.pdf?msockid=156c5513e5e96cdb283d4228e46a6db8

    The io worker threads should run full steam ahead and not necessarily do
    any user processing. They should only block when there is no io to do at
    all.

    struct cohort
    {
    per_io* m_recv;
    per_io* m_send;
    per_io* m_accept;
    per_io* m_connect;
    //...
    };

    Just heads for single linked lists of per io data wrt WSAOVERLAPPED.

    Pass execute the cohort usually in another thread pool.

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Tue Jun 9 21:55:35 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/9/2026 9:52 PM, Chris M. Thomasson wrote:

    IOCP is the way to go on Windows. Fwiw, I used it quite a bit around 25+ years ago back on Windows NT 4.0 Then GQCSEX came out:

    https://learn.microsoft.com/en-us/windows/win32/fileio/ getqueuedcompletionstatusex-func

    That is a fun one that returns more than one completion request.

    However, you have to know how to use it correctly! For instance, I would gather the io completions and sort them as usually wsasends, wsarecvs, acceptex, connectex, ect into separate per thread stacks. Then execute
    them in batches sometimes on another thread pool. I remember an old
    paper, cohort scheduling.

    https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/ tr-2001-39.pdf?msockid=156c5513e5e96cdb283d4228e46a6db8

    The io worker threads should run full steam ahead and not necessarily do
    any user processing. They should only block when there is no io to do at all.

    struct cohort
    {
    ˙˙˙ per_io* m_recv;
    ˙˙˙ per_io* m_send;
    ˙˙˙ per_io* m_accept;
    ˙˙˙ per_io* m_connect;
    ˙˙˙ //...
    };

    Just heads for single linked lists of per io data wrt WSAOVERLAPPED.

    Pass execute the cohort usually in another thread pool.

    The only time an IO thread should block is when there is NO io to do...

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Tue Jun 9 22:05:04 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/9/2026 9:52 PM, Chris M. Thomasson wrote:
    [...]

    You can see how that would work right? a cohort is built up on an io
    thread using the fact that GQCSEX can return multiple completions, and
    we can check it using a zero timeout. If that returns no completions,
    then that can be one of the triggers for the io thread to pass its per
    thread cohort to the logic threads.

    So, we know that after a GQCSEX fails to return any completions, we can
    send local cohorts to the logic threads, and wait on GQCSEX with a
    timeout. Usually say one minute. Then the IO thread can timeout and
    check things, try again, etc. This works with INFINITE timeout as well,
    but a minute timeout can be good as well, depending on your needs.

    So a cohort was actually:

    struct cohort
    {
    struct cohort* m_next;
    per_io* m_recv;
    per_io* m_send;
    per_io* m_accept;
    per_io* m_connect;
    //...
    };





    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Tue Jun 9 23:01:28 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/9/2026 4:47 PM, Lawrence D?Oliveiro wrote:
    On Tue, 9 Jun 2026 13:54:51 -0700, Chris M. Thomasson wrote:

    ir_uring? ;^)

    io_uring, you mean?

    That, too, is a possibility, for even higher performance.

    <https://manpages.debian.org/io_uring(7)>

    I just remembered some of the "fun" functions for IOCP on Windows. TransmitPackets and TransmitFile.

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

    Petty cool, except iirc the client versions of nt 4.0 nerfed them to
    only two concurrent in flight calls at a time.

    AcceptEx and ConnectEx were pretty cool as well.

    https://learn.microsoft.com/en-us/windows/win32/api/mswsock/nf-mswsock-acceptex

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



    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Wed Jun 10 06:03:19 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Tue, 9 Jun 2026 21:52:39 -0700, Chris M. Thomasson wrote:

    IOCP is the way to go on Windows.

    I think one reason why it?s never been adopted cross-platform is that
    it requires threading to be useful. Whereas the *nix poll(2) technique
    is scalable across single-threaded and multi-threaded usage.

    Microsoft needs to fix its I/O handling to be more friendly to
    *nix-style ways of doing things. Otherwise the Windows-specific gaps
    listed on this sort of thing
    <https://docs.python.org/3/library/select.html> just look
    embarrassing.

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Wed Jun 10 06:21:28 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Tue, 9 Jun 2026 21:42:58 -0700, Chris M. Thomasson wrote:

    On 6/9/2026 4:47 PM, Lawrence D?Oliveiro wrote:

    That, too, is a possibility, for even higher performance.

    <https://manpages.debian.org/io_uring(7)>

    Oh I think so.

    I think more suited for block-device (disk/SSD) I/O, rather than
    network I/O. Most network I/O (say, up to a few gigabits per second)
    would most likely hit a bottleneck in the physical network interface,
    rather than in the rate at which the userland code can produce/consume
    the data.

    Also, this: <https://manpages.debian.org/aio(7)> -- an actual POSIX
    spec, not Linux-specific, perhaps not having the best performance ...

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Wed Jun 10 06:47:38 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Tue, 9 Jun 2026 23:01:28 -0700, Chris M. Thomasson wrote:

    I just remembered some of the "fun" functions for IOCP on Windows. TransmitPackets and TransmitFile.

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

    Why do you need separate calls for ?sockets? versus ?files??

    I was looking for equivalent Linux calls, and found a remarkable number:

    <https://manpages.debian.org/copy_file_range(2)> <https://manpages.debian.org/sendfile(2)> <https://manpages.debian.org/splice(2)> <https://manpages.debian.org/vmsplice(2)>

    Petty cool, except iirc the client versions of nt 4.0 nerfed them to
    only two concurrent in flight calls at a time.

    AcceptEx and ConnectEx were pretty cool as well.

    https://learn.microsoft.com/en-us/windows/win32/api/mswsock/nf-mswsock-acceptex

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

    Mainly to avoid a separate I/O call to send/receive the first lot of
    data? Does it do that much for performance?

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From fir@3:633/10 to All on Wed Jun 10 08:55:37 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    Lawrence D?Oliveiro pisze:
    On Tue, 9 Jun 2026 13:53:28 +0200, fir wrote:

    sad nevs ai says that TCP not guarantees that whole pack would be
    received and it can be only part... so it complicates code using it
    a bit

    Why? Surely you would not try to handle an incoming request or
    response until you were sure you had received the whole thing,
    wouldn?t you?

    well if it would be guarantee if i got it its a whole then i no need to
    check in client code

    (note btw i got no experience in any network programing except writing
    one or two winsock hello worlds..and here i try to understand the
    problem with no experience more lika arhitecturally/theoretically (so
    i can make many mistakes not knowing the reality/practice ...but the
    reality seems so boring it was always to boring to learn - when spending
    some
    time to try to understand it theoretically is at least less borong)

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From fir@3:633/10 to All on Wed Jun 10 09:06:08 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    Lawrence D?Oliveiro pisze:
    On Tue, 9 Jun 2026 11:34:36 +0200, fir wrote:

    Lawrence D?Oliveiro pisze:

    On Tue, 9 Jun 2026 08:56:00 +0200, fir wrote:

    you know what sleep() function is its extremally often used basic
    windows function which sleeps main thread for n miliseconds, every
    or nearly every (afait) windows app uses it so its totally notmall

    Maybe normal in Windows, but in regular multitasking OSes, we have
    these standard techniques for maximizing responsiveness while
    minimizing resource usage. Which is why systems like Linux can
    scale gracefully to tens or even hundreds of thousands of
    simultaneous peer connections.

    this standard techniques are not necesarelly much good imo...ans
    sleep is architecturally simple and not bad imo

    You keep saying that, even after I point out why it?s a bad idea.

    this is also not inneficient - its efficient as it returns power to
    system (somore app uses sleep more lightweight it is i would say)

    Think of how you could do enough peak throughput to saturate a gigabit Ethernet link. This is at the low end of network connection speeds
    these days -- higher-performance configurations might have an order of magnitude or two greater bandwidth.

    To manage it, you?d need to push through about 120 megabytes per
    second. With your sleep-every-100ms poll, this means each I/O request
    would need a buffer size of about 12 megabytes. This is ridiculously
    large. And of course the 100ms latency would be unacceptable for many
    uses -- think of a multiuser game server, for example.

    this 100 ms was an example not more meaning than using "foo" name if you
    can change "foo" into "boo" then you can turn 100 ms into 0.1 ms

    i hope youre not think i would put 100 ms in a situation when you need 1
    ms or 0.1 ms...if you think so yure exceptionally vrong

    this polling in active loop is generally good becouse it is so simple it
    nt rises complications..you dont need additionsl thread, you dont hang
    on input etc.. note also polling is very almost extremally cheep

    becouse if you do some check then rise sleep

    for(;;)
    {
    if(someting_here) {}
    sleep(0.1)
    }

    then loop and if takes few cycles, where sleep 0.1 ms takes about 300
    000 cycles (switching cpu off to another route tales also some) so the
    cost is microscopic... i dont think alternative methods are faster

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Wed Jun 10 00:14:56 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/9/2026 11:21 PM, Lawrence D?Oliveiro wrote:
    On Tue, 9 Jun 2026 21:42:58 -0700, Chris M. Thomasson wrote:

    On 6/9/2026 4:47 PM, Lawrence D?Oliveiro wrote:

    That, too, is a possibility, for even higher performance.

    <https://manpages.debian.org/io_uring(7)>

    Oh I think so.

    I think more suited for block-device (disk/SSD) I/O, rather than
    network I/O. Most network I/O (say, up to a few gigabits per second)
    would most likely hit a bottleneck in the physical network interface,
    rather than in the rate at which the userland code can produce/consume
    the data.

    Also, this: <https://manpages.debian.org/aio(7)> -- an actual POSIX
    spec, not Linux-specific, perhaps not having the best performance ...

    io_uring should work fine for network I/O. io_uring?s benefits only
    appear at extreme scale?

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Wed Jun 10 00:24:35 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/9/2026 11:03 PM, Lawrence D?Oliveiro wrote:
    On Tue, 9 Jun 2026 21:52:39 -0700, Chris M. Thomasson wrote:

    IOCP is the way to go on Windows.
    I think one reason why it?s never been adopted cross-platform is that
    it requires threading to be useful. Whereas the *nix poll(2) technique
    is scalable across single-threaded and multi-threaded usage.

    You can run IOCP with a single thread, nothing stops you. But why
    deliberately nerf the model? IOCP isn?t ?thread?heavy,? it?s
    completion?driven. Threads are just the delivery mechanism, not the
    concurrency model. Create an IO worker thread pool and an IOCP port, and
    that?s the start.

    On Windows, async I/O is basically native. You don?t poll for readiness,
    you don?t spin on EAGAIN, and you don?t build a giant state machine. The
    kernel completes the operation when the data is actually ready.

    If you want single?threaded event loops, that?s what Unix readiness APIs
    are for. IOCP solves a different problem.

    However, io_uring is pretty neat!


    Microsoft needs to fix its I/O handling to be more friendly to
    *nix-style ways of doing things. Otherwise the Windows-specific gaps
    listed on this sort of thing
    <https://docs.python.org/3/library/select.html> just look
    embarrassing.

    Windows I/O is unified and async across all device types ? that?s the
    whole point of IOCP.

    If anything, Unix is the one still trying to catch up with a real async
    model (see: io_uring).

    And yes? never use select() for anything serious. ;^)

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Wed Jun 10 00:31:38 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/10/2026 12:14 AM, Chris M. Thomasson wrote:
    On 6/9/2026 11:21 PM, Lawrence D?Oliveiro wrote:
    On Tue, 9 Jun 2026 21:42:58 -0700, Chris M. Thomasson wrote:

    On 6/9/2026 4:47 PM, Lawrence D?Oliveiro wrote:

    That, too, is a possibility, for even higher performance.

    <https://manpages.debian.org/io_uring(7)>

    Oh I think so.

    I think more suited for block-device (disk/SSD) I/O, rather than
    network I/O. Most network I/O (say, up to a few gigabits per second)
    would most likely hit a bottleneck in the physical network interface,
    rather than in the rate at which the userland code can produce/consume
    the data.

    Also, this: <https://manpages.debian.org/aio(7)> -- an actual POSIX
    spec, not Linux-specific, perhaps not having the best performance ...

    io_uring should work fine for network I/O. io_uring?s benefits only
    appear at extreme scale?

    Afaict, at extreme scale (100k+ connections, microburst workloads)
    io_uring is the only Linux API that can keep up without heroic tuning...

    Actually, its lower level than IOCP. We have to manage our own ring buffers.

    But IOCP and io_uring has an interesting mapping... They are fairly damn similar! IOCP and io_uring map onto each other in a way that?s almost
    eerie. They?re not identical, but conceptually they solve the same
    problem with almost the same architecture, just at different abstraction levels...

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Wed Jun 10 00:34:04 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/10/2026 12:06 AM, fir wrote:
    Lawrence D?Oliveiro pisze:
    On Tue, 9 Jun 2026 11:34:36 +0200, fir wrote:

    Lawrence D?Oliveiro pisze:

    On Tue, 9 Jun 2026 08:56:00 +0200, fir wrote:

    you know what sleep() function is its extremally often used basic
    windows function which sleeps main thread for n miliseconds, every
    or nearly every (afait) windows app uses it so its totally notmall

    Maybe normal in Windows, but in regular multitasking OSes, we have
    these standard techniques for maximizing responsiveness while
    minimizing resource usage. Which is why systems like Linux can
    scale gracefully to tens or even hundreds of thousands of
    simultaneous peer connections.

    this standard techniques are not necesarelly much good imo...ans
    sleep is architecturally simple and not bad imo

    You keep saying that, even after I point out why it?s a bad idea.

    this is also not inneficient - its efficient as it returns power to
    system (somore app uses sleep more lightweight it is i would say)

    Think of how you could do enough peak throughput to saturate a gigabit
    Ethernet link. This is at the low end of network connection speeds
    these days -- higher-performance configurations might have an order of
    magnitude or two greater bandwidth.

    To manage it, you?d need to push through about 120 megabytes per
    second. With your sleep-every-100ms poll, this means each I/O request
    would need a buffer size of about 12 megabytes. This is ridiculously
    large. And of course the 100ms latency would be unacceptable for many
    uses -- think of a multiuser game server, for example.

    this 100 ms was an example not more meaning than using "foo" name if you
    can change "foo" into "boo" then you can turn 100 ms into 0.1 ms

    i hope youre not think i would put 100 ms in a situation when you need 1
    ms or 0.1 ms...if you think so yure exceptionally vrong

    this polling in active loop is generally good becouse it is so simple it
    nt rises complications..you dont need additionsl thread, you dont hang
    on input etc.. note also polling is very almost extremally cheep

    becouse if˙ you do some check then rise sleep

    for(;;)
    {
    if(someting_here) {}
    sleep(0.1)
    }

    then loop and if takes few cycles, where sleep 0.1 ms takes about 300
    000 cycles (switching cpu off to another route tales also some) so the
    cost is microscopic... i dont think alternative methods are faster

    why sleep? You should be waiting for IO to complete. The only time a io
    thread should block is when there is no IO to do. The server is idle.

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From fir@3:633/10 to All on Wed Jun 10 12:37:47 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    Chris M. Thomasson pisze:
    On 6/10/2026 12:06 AM, fir wrote:
    Lawrence D?Oliveiro pisze:
    On Tue, 9 Jun 2026 11:34:36 +0200, fir wrote:

    Lawrence D?Oliveiro pisze:

    On Tue, 9 Jun 2026 08:56:00 +0200, fir wrote:

    you know what sleep() function is its extremally often used basic
    windows function which sleeps main thread for n miliseconds, every >>>>>> or nearly every (afait) windows app uses it so its totally notmall

    Maybe normal in Windows, but in regular multitasking OSes, we have
    these standard techniques for maximizing responsiveness while
    minimizing resource usage. Which is why systems like Linux can
    scale gracefully to tens or even hundreds of thousands of
    simultaneous peer connections.

    this standard techniques are not necesarelly much good imo...ans
    sleep is architecturally simple and not bad imo

    You keep saying that, even after I point out why it?s a bad idea.

    this is also not inneficient - its efficient as it returns power to
    system (somore app uses sleep more lightweight it is i would say)

    Think of how you could do enough peak throughput to saturate a gigabit
    Ethernet link. This is at the low end of network connection speeds
    these days -- higher-performance configurations might have an order of
    magnitude or two greater bandwidth.

    To manage it, you?d need to push through about 120 megabytes per
    second. With your sleep-every-100ms poll, this means each I/O request
    would need a buffer size of about 12 megabytes. This is ridiculously
    large. And of course the 100ms latency would be unacceptable for many
    uses -- think of a multiuser game server, for example.

    this 100 ms was an example not more meaning than using "foo" name if
    you can change "foo" into "boo" then you can turn 100 ms into 0.1 ms

    i hope youre not think i would put 100 ms in a situation when you need
    1 ms or 0.1 ms...if you think so yure exceptionally vrong

    this polling in active loop is generally good becouse it is so simple
    it nt rises complications..you dont need additionsl thread, you dont hang
    on input etc.. note also polling is very almost extremally cheep

    becouse if˙ you do some check then rise sleep

    for(;;)
    {
    if(someting_here) {}
    sleep(0.1)
    }

    then loop and if takes few cycles, where sleep 0.1 ms takes about 300
    000 cycles (switching cpu off to another route tales also some) so the
    cost is microscopic... i dont think alternative methods are faster

    why sleep? You should be waiting for IO to complete. The only time a io thread should block is when there is no IO to do. The server is idle.

    why you think YOU SHOULD be waiting? waiting makes some complications
    (like for example you can wait only on one thing - so its like BRAIN
    OFF) in general you should monitor conditions activelly and react
    accordingly imo

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Scott Lurndal@3:633/10 to All on Wed Jun 10 14:56:03 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    Lawrence =?iso-8859-13?q?D=FFOliveiro?= <ldo@nz.invalid> writes:
    On Tue, 9 Jun 2026 13:55:25 -0700, Chris M. Thomasson wrote:

    On 6/9/2026 2:10 AM, Lawrence D?Oliveiro wrote:

    ... in regular multitasking OSes, we have these standard techniques
    for maximizing responsiveness while minimizing resource usage.
    Which is why systems like Linux can scale gracefully to tens or
    even hundreds of thousands of simultaneous peer connections.

    Well, for servers/clients in windows, IOCP is key.

    IOCP is based on the asynchronous I/O model from DEC?s old VMS
    operating system, which Dave Cutler also masterminded before moving to >Microsoft to create Windows NT.

    Nobody else seems to have thought it a worthwhile enough model to
    copy, though. I think it requires you to have multiple I/O requests in >flight, one for each connection you want to watch. This might make for
    a more complicated programming model, as opposed to the simplicity of >poll(2)/epoll(2).

    VMS applications for high performance async I/O used ASTs or Event Flags
    for synchronization. Using ASTs was preferred for high-throughput
    I/O.

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Wed Jun 10 11:40:32 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/10/2026 3:37 AM, fir wrote:
    Chris M. Thomasson pisze:
    On 6/10/2026 12:06 AM, fir wrote:
    Lawrence D?Oliveiro pisze:
    On Tue, 9 Jun 2026 11:34:36 +0200, fir wrote:

    Lawrence D?Oliveiro pisze:

    On Tue, 9 Jun 2026 08:56:00 +0200, fir wrote:

    you know what sleep() function is its extremally often used basic >>>>>>> windows function which sleeps main thread for n miliseconds, every >>>>>>> or nearly every (afait) windows app uses it so its totally notmall >>>>>>
    Maybe normal in Windows, but in regular multitasking OSes, we have >>>>>> these standard techniques for maximizing responsiveness while
    minimizing resource usage. Which is why systems like Linux can
    scale gracefully to tens or even hundreds of thousands of
    simultaneous peer connections.

    this standard techniques are not necesarelly much good imo...ans
    sleep is architecturally simple and not bad imo

    You keep saying that, even after I point out why it?s a bad idea.

    this is also not inneficient - its efficient as it returns power to
    system (somore app uses sleep more lightweight it is i would say)

    Think of how you could do enough peak throughput to saturate a gigabit >>>> Ethernet link. This is at the low end of network connection speeds
    these days -- higher-performance configurations might have an order of >>>> magnitude or two greater bandwidth.

    To manage it, you?d need to push through about 120 megabytes per
    second. With your sleep-every-100ms poll, this means each I/O request
    would need a buffer size of about 12 megabytes. This is ridiculously
    large. And of course the 100ms latency would be unacceptable for many
    uses -- think of a multiuser game server, for example.

    this 100 ms was an example not more meaning than using "foo" name if
    you can change "foo" into "boo" then you can turn 100 ms into 0.1 ms

    i hope youre not think i would put 100 ms in a situation when you
    need 1 ms or 0.1 ms...if you think so yure exceptionally vrong

    this polling in active loop is generally good becouse it is so simple
    it nt rises complications..you dont need additionsl thread, you dont
    hang
    on input etc.. note also polling is very almost extremally cheep

    becouse if˙ you do some check then rise sleep

    for(;;)
    {
    if(someting_here) {}
    sleep(0.1)
    }

    then loop and if takes few cycles, where sleep 0.1 ms takes about 300
    000 cycles (switching cpu off to another route tales also some) so the
    cost is microscopic... i dont think alternative methods are faster

    why sleep? You should be waiting for IO to complete. The only time a
    io thread should block is when there is no IO to do. The server is idle.

    why you think YOU SHOULD be waiting? waiting makes some complications
    (like for example you can wait only on one thing - so its like BRAIN
    OFF) in general you should monitor conditions activelly and react accordingly imo

    Huh? What do you mean by waiting on only one thing? Take IOCP, you wait
    on the port for any io completion. So, its waiting for activity. Take a
    close look at the following because I think reading that might help you understand:

    https://learn.microsoft.com/en-us/windows/win32/fileio/getqueuedcompletionstatusex-func

    Read all of it.

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Wed Jun 10 12:02:59 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/8/2026 5:28 PM, Lawrence D?Oliveiro wrote:
    On Mon, 8 Jun 2026 18:16:10 +0200, fir wrote:

    Sleep(100); //wait 100 ms

    That?s usually a dumb thing to do.

    More ignorant than dumb wrt to fir?


    It?s either too slow if something
    comes in/goes out more quickly, or too much overhead if communication
    is slower than that. And it just gets worse if you?re trying to juggle multiple connections (as a server commonly does).

    Try using this <https://manpages.debian.org/poll(2)>, at least ...


    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Thu Jun 11 00:01:41 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Wed, 10 Jun 2026 12:37:47 +0200, fir wrote:

    why you think YOU SHOULD be waiting? waiting makes some
    complications (like for example you can wait only on one thing ...

    Heck, no. Look at this man page <https://manpages.debian.org/poll(2)>:
    you give it a collection of FDs (these can be any mixture of things
    like sockets, pipes, character devices ... actually any kind of file
    is valid). You specify for each one whether you are waiting for it to
    be read-ready, write-ready, or both. And on top of that you can
    specify a timeout, in case you have some other tasks to perform that
    you don?t want to hold up for *too* long.

    A common use for the timeout is to do a periodic scan for client
    network connections that have gone idle for too long, so the server
    should give up and abandon those connections.

    And then the call returns when one or more of those FDs are in the
    specified states, or the timeout (if specified) has elapsed.

    An even more advanced set of calls is this <https://manpages.debian.org/epoll(7)>. That offers the option for
    monitoring individual FDs on a level-triggered or edge-triggered
    basis.

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Thu Jun 11 00:07:11 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Wed, 10 Jun 2026 00:24:35 -0700, Chris M. Thomasson wrote:

    Windows I/O is unified and async across all device types ? that?s
    the whole point of IOCP.

    Sure. That same sort of feature was integral both the previous OSes
    Dave Cutler had a hand in: VAX/VMS and RSX-11.

    If anything, Unix is the one still trying to catch up with a real
    async model (see: io_uring).

    You mean Linux? Yes, it did inherit the Unix idea of ?all I/O is
    blocking?, so to do non-blocking calls you should spawn extra
    processes -- or from the 1990s onwards, extra threads.

    I agree, it might be nice to see a complete separation within the
    kernel between I/O operation management and process scheduling.

    But, let?s face it, even with the current model, Linux server
    performance still leaves Windows for dead.

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Thu Jun 11 00:15:18 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Wed, 10 Jun 2026 00:31:38 -0700, Chris M. Thomasson wrote:

    Actually, its lower level than IOCP. We have to manage our own ring
    buffers.

    But IOCP and io_uring has an interesting mapping... They are fairly
    damn similar! IOCP and io_uring map onto each other in a way that?s
    almost eerie. They?re not identical, but conceptually they solve the
    same problem with almost the same architecture, just at different
    abstraction levels...

    I think a key point of io_uring is to minimize the frequency of user/kernel-mode transitions.

    One limitation of Windows is that, unlike *nix systems, you cannot
    share open file descriptions (particularly network connections, named
    pipes, I/O completion ports, etc) between processes.

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Thu Jun 11 00:16:37 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Wed, 10 Jun 2026 12:02:59 -0700, Chris M. Thomasson wrote:

    On 6/8/2026 5:28 PM, Lawrence D?Oliveiro wrote:

    On Mon, 8 Jun 2026 18:16:10 +0200, fir wrote:

    Sleep(100); //wait 100 ms

    That?s usually a dumb thing to do.

    More ignorant than dumb wrt to fir?

    Ignorance should go away with enlightenment.

    If they persist in sticking to it, then it becomes wilful ignorance.

    Which is just ... dumb.

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Bonita Montero@3:633/10 to All on Thu Jun 11 07:24:00 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    Am 08.06.2026 um 17:49 schrieb fir:

    i was doing only basics of socket programming anver liked it and
    remember almost nothing - it is becouse i dont liek stupid things
    and those sockets looks stupid

    Use Boost.ASIO. ;-)

    --- PyGate Linux v1.5.15
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Thu Jun 11 13:27:22 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/9/2026 11:47 PM, Lawrence D?Oliveiro wrote:
    On Tue, 9 Jun 2026 23:01:28 -0700, Chris M. Thomasson wrote:

    I just remembered some of the "fun" functions for IOCP on Windows.
    TransmitPackets and TransmitFile.

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

    Why do you need separate calls for ?sockets? versus ?files??

    I was looking for equivalent Linux calls, and found a remarkable number:

    <https://manpages.debian.org/copy_file_range(2)> <https://manpages.debian.org/sendfile(2)> <https://manpages.debian.org/splice(2)> <https://manpages.debian.org/vmsplice(2)>

    Petty cool, except iirc the client versions of nt 4.0 nerfed them to
    only two concurrent in flight calls at a time.

    AcceptEx and ConnectEx were pretty cool as well.

    https://learn.microsoft.com/en-us/windows/win32/api/mswsock/nf-mswsock-acceptex

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

    Mainly to avoid a separate I/O call to send/receive the first lot of
    data? Does it do that much for performance?

    Send it right from memory. It handles everything. It completes with a
    status. It way more efficient than sending a file via WSASend'.

    --- PyGate Linux v1.5.16
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Fri Jun 12 01:35:30 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Thu, 11 Jun 2026 13:27:22 -0700, Chris M. Thomasson wrote:

    On 6/9/2026 11:47 PM, Lawrence D?Oliveiro wrote:

    Mainly to avoid a separate I/O call to send/receive the first lot
    of data? Does it do that much for performance?

    Send it right from memory. It handles everything. It completes with
    a status. It way more efficient than sending a file via WSASend'.

    But that only works for a small amount of data. For which you might as
    well use datagrams (e.g. UDP) rather than a full virtual circuit
    (e.g. TCP).

    --- PyGate Linux v1.5.16
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Thu Jun 11 21:08:25 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/10/2026 5:15 PM, Lawrence D?Oliveiro wrote:
    On Wed, 10 Jun 2026 00:31:38 -0700, Chris M. Thomasson wrote:

    Actually, its lower level than IOCP. We have to manage our own ring
    buffers.

    But IOCP and io_uring has an interesting mapping... They are fairly
    damn similar! IOCP and io_uring map onto each other in a way that?s
    almost eerie. They?re not identical, but conceptually they solve the
    same problem with almost the same architecture, just at different
    abstraction levels...

    I think a key point of io_uring is to minimize the frequency of user/kernel-mode transitions.

    Yeah. Actually, its kind of more "akin" to say using dx12 vs modern
    opengl. You have to manage a lot of the work yourself.


    One limitation of Windows is that, unlike *nix systems, you cannot
    share open file descriptions (particularly network connections, named
    pipes, I/O completion ports, etc) between processes.

    I think one can use WSADuplicateSocket, but that can be dangerous.
    Sharing a single IOCP between different processes, is well. Probably
    going to not work. Never did that anyway.

    --- PyGate Linux v1.5.16
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Dan Cross@3:633/10 to All on Wed Jun 10 12:28:30 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    [Followup-to: comp.os.plan9]

    In article <20260609141644.458@kylheku.com>,
    Kaz Kylheku <046-301-5902@kylheku.com> wrote:
    On 2026-06-08, fir <profesor.fir@gmail.com> wrote:
    https://www.youtube.com/watch?v=XAzUoizwnXM

    i dint watched it whole but it comes to my mind that those socket
    communication indeed should be probably made using
    fopen/fread/fwrite/fgetc/fputc

    That's how it is in the Plan 9 operating system. It takes the
    "everything is a file" paradigm that Unix started on. Unix diverged
    from that paradigm in implementing new things like networking.

    That is actually how Unix networking was done initially, cf RFC
    681 or the MIT CHAOS implementation; the mechanism for the
    latter was to use `namei` in the kernel to open a "network
    device" that implemented NCP ("/dev/net") and then exploit a
    hack where extra data in the pathname could be passed to the
    device's `open` entry point in the `cdevsw`.

    The problem was that this wasn't very flexible and opened up all
    kinds of problems with respect to how the namespace is managed,
    what kind of protocol you wanted: what does it mean if you alias
    a name via `link`? Etc.

    Plan 9 fixes this by having a different file-based interface
    between a program and the network stack in the kernel. The
    observation is that sockets are accessed via something that
    looks an awful lot like a file descriptor (which is itself just
    a small integer; internally this is an index into a table), but
    they exist in a wholly different namespace that is disconnected
    from the file namespace.

    The Plan 9 authors observed that there's no reason that that
    must be the case, and so while on Unix the model was "everything
    is a file" (not true, of course), on Plan 9, it is, "everything
    is a file system": that is, devices expose a small hierarchy of
    files, which together expose the device's interface. Of course,
    "device" is generic here and includes pseudo-devices; one may
    think of the network stack as a device, but so is the window
    system, your email inbox, and so on. Note that we speak of
    these as "files" but they don't actually exist on a storage
    device, and there is no taxonomy of block and character devices
    as there is on Unix. Rather, files are just named resources
    that are mounted into the file name hierarchy as seen by some
    process: on Plan 9, file namespaces (as seen by `ls` and so on)
    are per-process (group), and `mount` is unprivileged and always
    available to a program. Thus, "files" may refer to something
    on a storage device somewhere, or they may refer to a device, or
    they may refer to an IPC endpoint created by a user program.

    So for networking, the kernel models protocols as pseudo-devices
    that it calls "protocol devices". These are mounted into the
    process namespace, canonically on `/net`, so that we have
    `/net/tcp` and so on. If I want to create a new TCP connection,
    I can open, `/net/tcp/clone`; this creates a new connection
    object in the kernel, which causes a new, numbered directory to
    spring into existence under `/net/tcp/$n$`. That has `ctl` and
    `data` files under it; I can connect to a remote machine by
    `echo`ing data into the `ctl` file; reading and writing the
    `data` files receives and send data on the connection. If I
    `close` the data file (and nothing else is holding a reference
    to the connection) then the connection is closed, and the
    connection object in the kernel reclaimed, and the directory
    removed. There's a library routine to do this dance for you,
    called `dial`; it takes a string argument, something like: `dial("tcp!some.host.name!service");` and returns a file
    descriptor or error, but an astute reader will see that it is
    possible to create a shell script that creates TCP connections
    with no changes to the shell.

    Another interesting aspect of the design: Plan 9 uses a simple
    protocol called "9P" to share file systems over a network; to
    use some remote machine's resources, I can import them (over 9P)
    into the namespace of my local system and just
    open/read/write/close them.

    This composes in interesting ways: Given some remote machine, I
    can import its network stack into my own namespace, and make (or
    receive) connections from (and to), but all running on a
    different computer. Similarly, `/proc` is a filesystem that I
    can import; so I can debug or trace a program running on a
    remote system, but run the debugger locally; all without an
    elaborate "remote debugging" protocol.

    More information is available in the original papers, that are
    well worth a tread:

    http://9p.io/sys/doc/9.html
    http://9p.io/sys/doc/names.html
    http://9p.io/sys/doc/net/net.html
    http://9p.io/sys/doc/auth.html

    (The auth one is particularly interesting.)

    i was doing only basics of socket programming anver liked it and
    remember almost nothing - it is becouse i dont liek stupid things
    and those sockets looks stupid

    i guess using this fopen it would be much better..

    "Using fopen" is better is basically "using strings is better"
    in disguise. When you use fopen to open a network client or server >connection, all the connection parameters have to be encoded into
    a character string, instead of binary structures.

    That makes some things easy, such as binding to networking from a new >programming language (no "FFI" required, just buffered file I/O and
    string munging).

    The strings are inefficient, though; they have to be formatted
    and parsed. They lack type safety. You can put wrong values
    into a binary address structure, but in a string you can cause
    a syntax error. And worse, injection security holes and whatnot.

    See above. Trying to pack everything into a single file name
    passed to `fopen` (or `open`) isn't a good abstraction, but
    there is little materially different between creating binary
    data structures like `sockaddr_in` or `sockaddr_in6`, or
    composing a network address in a string that is passed to a
    library routine. In most cases, we use things like symbolic
    host names and textual port numbers that have to be parsed and
    resolved anyway. In all cases, the input data needs to be
    validated by both the stack and the programmer who creates the
    data structures.

    The more interesting thing is how the system models the
    protocols and the interface it provides.

    None of this has to do with C, except that Plan 9 was written in
    a dialect of C (the early work predated the ANSI standard, they
    made extensions to the language, and in a few places it is
    incompatible: the type promotion rules for arithmetic, for
    instance).

    - Dan C.

    --- PyGate Linux v1.5.16
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Sat Jun 13 00:10:35 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Thu, 11 Jun 2026 21:08:25 -0700, Chris M. Thomasson wrote:

    Sharing a single IOCP between different processes, is well. Probably
    going to not work. Never did that anyway.

    Yeah, you see, a key part of the original Unix philosophy was to use
    multiple processes to achieve concurrency/asynchrony. Multithreading
    came later. And I think asynchronous I/O completion callbacks were
    considered too low-level a concept to be worthy of userspace.

    Since process creation was such a common operation, a lot of work went
    into making it as efficient as possible.

    Whereas Windows NT was created by a Unix-hater refugee from DEC. His
    previous OS, VMS, had a process-creation operation that was quite
    expensive, so you were discouraged from creating lots of processes as
    part of a single program. And he took that idea (among others) with
    him when he joined Microsoft.

    --- PyGate Linux v1.5.16
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Sat Jun 13 14:26:14 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/11/2026 6:35 PM, Lawrence D?Oliveiro wrote:
    On Thu, 11 Jun 2026 13:27:22 -0700, Chris M. Thomasson wrote:

    On 6/9/2026 11:47 PM, Lawrence D?Oliveiro wrote:

    Mainly to avoid a separate I/O call to send/receive the first lot
    of data? Does it do that much for performance?

    Send it right from memory. It handles everything. It completes with
    a status. It way more efficient than sending a file via WSASend'.

    But that only works for a small amount of data. For which you might as
    well use datagrams (e.g. UDP) rather than a full virtual circuit
    (e.g. TCP).

    What that is besides the point in a sense, category error, perhaps? TransmitPackets is an efficient way to send some things, winnt client
    nerf aside for a moment. Actually, around 25+ years ago, I had a system
    where you would make a TCP connection, and use UDP for sending a file.
    The packets had file offsets where the receiver knew where to write them
    to say a memory mapped file. The TCP connection would handle basic
    tasks, the UDP for for bulk data transfer. A fun experiment.

    --- PyGate Linux v1.5.16
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Sat Jun 13 14:32:24 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/13/2026 2:26 PM, Chris M. Thomasson wrote:
    On 6/11/2026 6:35 PM, Lawrence D?Oliveiro wrote:
    On Thu, 11 Jun 2026 13:27:22 -0700, Chris M. Thomasson wrote:

    On 6/9/2026 11:47 PM, Lawrence D?Oliveiro wrote:

    Mainly to avoid a separate I/O call to send/receive the first lot
    of data? Does it do that much for performance?

    Send it right from memory. It handles everything. It completes with
    a status. It way more efficient than sending a file via WSASend'.

    But that only works for a small amount of data. For which you might as
    well use datagrams (e.g. UDP) rather than a full virtual circuit
    (e.g. TCP).

    What that is besides the point in a sense, category error, perhaps? TransmitPackets is an efficient way to send some things, winnt client
    nerf aside for a moment. Actually, around 25+ years ago, I had a system where you would make a TCP connection, and use UDP for sending a file.
    The packets had file offsets where the receiver knew where to write them
    to say a memory mapped file. The TCP connection would handle basic
    tasks, the UDP for for bulk data transfer. A fun experiment.

    Actually, on Windows we should use TransmitPackets wherever we can.
    Using UDP is way different than using TransmitPackets on a TCP
    connection. With UDP you'd embed file offsets directly in the packets.
    This solves duplicated packets... Just write them, or discard them. Lost packets can use the TCP connection to show the state, and resend
    relevant data...

    Actually AcceptEx and ConnectEx on Windows are pretty fun... :^)

    --- PyGate Linux v1.5.16
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Sun Jun 14 00:45:02 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Sat, 13 Jun 2026 14:32:24 -0700, Chris M. Thomasson wrote:

    Actually, on Windows we should use TransmitPackets wherever we can.

    I was wondering why there are two separate API functions,
    ?TransmitPackets? versus ?TransmitFile?. It turns out the latter <https://learn.microsoft.com/en-us/windows/win32/api/mswsock/nf-mswsock-transmitfile>

    ... only supports connection-oriented sockets of type SOCK_STREAM,
    SOCK_SEQPACKET, and SOCK_RDM. Sockets of type SOCK_DGRAM and
    SOCK_RAW are not supported. The TransmitPackets function can be
    used with sockets of type SOCK_DGRAM.

    So there is some kind of overlap of functionality, but the two are
    optimized for slightly different application areas.

    Oddly, the docs for the former <https://learn.microsoft.com/en-us/windows/win32/api/mswsock/nc-mswsock-lpfn_transmitpackets>
    make no mention of SOCK_DGRAM. Is this call in fact suitable for *all*
    socket connection types? However, note this caveat:

    Expect better performance results when using the TransmitPackets
    function on Windows Server 2003.

    Doesn?t that apply to newer versions? Are you supposed to stick with
    Server 2003 to get the best out of it? Also, this:

    The TransmitPackets function is optimized according to the
    operating system on which it is used:

    ? On Windows server editions, the TransmitPackets function is
    optimized for high performance.
    ? On Windows client editions, the TransmitPackets function is
    optimized for minimum memory and resource utilization.

    So you need to use different calls to get high performance depending
    on the edition of Windows you?re running on?

    Seems like there?s a hodge-podge of motley functionality there, added
    to and modified over time by different groups with no clear overall
    vision driving things.

    Conway?s Law applies, I guess ...

    --- PyGate Linux v1.5.16
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Bonita Montero@3:633/10 to All on Sun Jun 14 14:44:06 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    Am 08.06.2026 um 17:49 schrieb fir:
    https://www.youtube.com/watch?v=XAzUoizwnXM

    i dint watched it whole but it comes to my mind that those socket communication indeed should be probably made using fopen/fread/fwrite/ fgetc/fputc
    i was doing only basics of socket programming anver liked it and
    remember almost nothing - it is becouse i dont liek stupid things
    and those sockets looks stupid
    i guess using this fopen it would be much better..
    whot would you need i assume you need to fopen connection to distant machine..not sure if it should be one the same for read write or two
    one for read and one for write..then i think the network card should
    have buffer whete there is stacked incoming data, same for outcoming
    data,a nd thats all as to basics probably..no hanging controll no
    additional threads..just like working with files
    whough additional soft could be written too, based on thai but it should
    be sane thing something based like with working with files (knowing
    those files are ram files and are contents of incoming and outcoming buffer thise sockets todajy i dont remember but in my vague mameory it feels
    like shit
    feel free to comment on this topic if you want

    The official name for fopen() for network is Boost.ASIO.

    --- PyGate Linux v1.5.16
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Sun Jun 14 13:55:58 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/13/2026 5:45 PM, Lawrence D?Oliveiro wrote:
    On Sat, 13 Jun 2026 14:32:24 -0700, Chris M. Thomasson wrote:

    Actually, on Windows we should use TransmitPackets wherever we can.

    I was wondering why there are two separate API functions,
    ?TransmitPackets? versus ?TransmitFile?. It turns out the latter <https://learn.microsoft.com/en-us/windows/win32/api/mswsock/nf-mswsock-transmitfile>

    ... only supports connection-oriented sockets of type SOCK_STREAM,
    SOCK_SEQPACKET, and SOCK_RDM. Sockets of type SOCK_DGRAM and
    SOCK_RAW are not supported. The TransmitPackets function can be
    used with sockets of type SOCK_DGRAM.

    So there is some kind of overlap of functionality, but the two are
    optimized for slightly different application areas.

    Oddly, the docs for the former <https://learn.microsoft.com/en-us/windows/win32/api/mswsock/nc-mswsock-lpfn_transmitpackets>
    make no mention of SOCK_DGRAM. Is this call in fact suitable for *all*
    socket connection types? However, note this caveat:

    Expect better performance results when using the TransmitPackets
    function on Windows Server 2003.

    Doesn?t that apply to newer versions? Are you supposed to stick with
    Server 2003 to get the best out of it? Also, this:

    It applies to new versions. TransmitPackets is there. But, The client
    versions of windows nerfs it.


    The TransmitPackets function is optimized according to the
    operating system on which it is used:

    ? On Windows server editions, the TransmitPackets function is
    optimized for high performance.
    ? On Windows client editions, the TransmitPackets function is
    optimized for minimum memory and resource utilization.

    So you need to use different calls to get high performance depending
    on the edition of Windows you?re running on?

    Well, on a client, iirc only two TransmitPackets/File are allowed to be
    in concurrent pending flight at one time. So, shit! I always hated that.
    Its been many years since I used it. Also, I always used them with TCP.
    I had my UDP thing, and that was for something else.

    Iirc, TransmitFile was before TransmitPackets.


    Seems like there?s a hodge-podge of motley functionality there, added
    to and modified over time by different groups with no clear overall
    vision driving things.

    Conway?s Law applies, I guess ...

    Shit happens. What do you think of AcceptEx and ConnectEx? ;^)

    --- PyGate Linux v1.5.16
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Tue Jun 16 04:36:17 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Sun, 14 Jun 2026 13:55:58 -0700, Chris M. Thomasson wrote:

    On 6/13/2026 5:45 PM, Lawrence D?Oliveiro wrote:

    <https://learn.microsoft.com/en-us/windows/win32/api/mswsock/nc-mswsock-lpfn_transmitpackets>
    ... note this caveat:

    Expect better performance results when using the TransmitPackets
    function on Windows Server 2003.

    Doesn?t that apply to newer versions? Are you supposed to stick
    with Server 2003 to get the best out of it?

    It applies to new versions.

    But the docs don?t say so. You?re just assuming that.

    What do you think of AcceptEx and ConnectEx? ;^)

    They seem optimized for circuit-oriented connections which
    send/receive very small amounts of data ... and unencrypted ones, at
    that. Is this a common use-case in the Windows world?

    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Tue Jun 16 13:08:49 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/15/2026 9:36 PM, Lawrence D?Oliveiro wrote:
    On Sun, 14 Jun 2026 13:55:58 -0700, Chris M. Thomasson wrote:

    On 6/13/2026 5:45 PM, Lawrence D?Oliveiro wrote:

    <https://learn.microsoft.com/en-us/windows/win32/api/mswsock/nc-mswsock-lpfn_transmitpackets>
    ... note this caveat:

    Expect better performance results when using the TransmitPackets
    function on Windows Server 2003.

    Doesn?t that apply to newer versions? Are you supposed to stick
    with Server 2003 to get the best out of it?

    It applies to new versions.

    But the docs don?t say so. You?re just assuming that.

    TransmitPackets/TransmitFile works on new windows. do you mean the
    performance benefit carries forward, or the API itself works? API works
    fine.


    What do you think of AcceptEx and ConnectEx? ;^)

    They seem optimized for circuit-oriented connections which
    send/receive very small amounts of data ... and unencrypted ones, at
    that. Is this a common use-case in the Windows world?

    unencrypted ones? Why should they encrypt? The user needs to do that
    before it sends anything.


    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Tue Jun 16 13:11:18 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/16/2026 1:08 PM, Chris M. Thomasson wrote:
    On 6/15/2026 9:36 PM, Lawrence D?Oliveiro wrote:
    On Sun, 14 Jun 2026 13:55:58 -0700, Chris M. Thomasson wrote:

    On 6/13/2026 5:45 PM, Lawrence D?Oliveiro wrote:

    <https://learn.microsoft.com/en-us/windows/win32/api/mswsock/nc-
    mswsock-lpfn_transmitpackets>
    ... note this caveat:

    ˙˙˙˙˙ Expect better performance results when using the TransmitPackets >>>> ˙˙˙˙˙ function on Windows Server 2003.

    Doesn?t that apply to newer versions? Are you supposed to stick
    with Server 2003 to get the best out of it?

    It applies to new versions.

    But the docs don?t say so. You?re just assuming that.

    TransmitPackets/TransmitFile works on new windows. do you mean the performance benefit carries forward, or the API itself works? API works fine.


    What do you think of AcceptEx and ConnectEx? ;^)

    They seem optimized for circuit-oriented connections which
    send/receive very small amounts of data ... and unencrypted ones, at
    that. Is this a common use-case in the Windows world?

    unencrypted ones? Why should they encrypt? The user needs to do that
    before it sends anything.


    ConnectEx can send some initial data as a convenience, but it's just
    bytes. if you need it encrypted, encrypt it before passing it in. That's
    true of any socket send API.

    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Wed Jun 17 03:11:47 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Tue, 16 Jun 2026 13:08:49 -0700, Chris M. Thomasson wrote:

    On 6/15/2026 9:36 PM, Lawrence D?Oliveiro wrote:

    They seem optimized for circuit-oriented connections which
    send/receive very small amounts of data ... and unencrypted ones,
    at that. Is this a common use-case in the Windows world?

    unencrypted ones? Why should they encrypt? The user needs to do that
    before it sends anything.

    The gold-standard protocol for doing this, namely TLS, requires a Diffie-Hellman exchange to set up the one-off session key for the
    connection. That takes more than one packet in each direction.

    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Wed Jun 17 12:13:19 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/16/2026 8:11 PM, Lawrence D?Oliveiro wrote:
    On Tue, 16 Jun 2026 13:08:49 -0700, Chris M. Thomasson wrote:

    On 6/15/2026 9:36 PM, Lawrence D?Oliveiro wrote:

    They seem optimized for circuit-oriented connections which
    send/receive very small amounts of data ... and unencrypted ones,
    at that. Is this a common use-case in the Windows world?

    unencrypted ones? Why should they encrypt? The user needs to do that
    before it sends anything.

    The gold-standard protocol for doing this, namely TLS, requires a Diffie-Hellman exchange to set up the one-off session key for the
    connection. That takes more than one packet in each direction.

    ConnectEx can optionally send data. That data is a bag o bytes.
    Encrypted or not. How one sets that up is up to them.

    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From BGB@3:633/10 to All on Wed Jun 17 18:41:57 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/8/2026 11:16 AM, fir wrote:
    fir pisze:
    https://www.youtube.com/watch?v=XAzUoizwnXM

    i dint watched it whole but it comes to my mind that those socket
    communication indeed should be probably made using fopen/fread/fwrite/
    fgetc/fputc

    i was doing only basics of socket programming anver liked it and
    remember almost nothing - it is becouse i dont liek stupid things
    and those sockets looks stupid

    i guess using this fopen it would be much better..

    whot would you need i assume you need to fopen connection to distant
    machine..not sure if it should be one the same for read write or two
    one for read and one for write..then i think the network card should
    have buffer whete there is stacked incoming data, same for outcoming
    data,a nd thats all as to basics probably..no hanging controll no
    additional threads..just like working with files

    whough additional soft could be written too, based on thai but it
    should be sane thing something based like with working with files
    (knowing those files are ram files and are contents of incoming and
    outcoming buffer

    thise sockets todajy i dont remember but in my vague mameory it feels
    like shit

    feel free to comment on this topic if you want

    maybe someone who has some experience with socked programming know how
    the basic communication would look like using this fopen scheme

    main()

    {
    ˙˙ FILE* f = fopen("1.2.3.4:555");

    ˙ fprintf(f, "hello there\n"); fflush(f);

    ˙ for(int i=0; i<100; i++)
    ˙ {
    ˙˙˙ static char buf[4096];
    ˙˙˙ if(fgets(buf, sizeof(buf), f))
    ˙˙˙˙˙˙ printf("incoming: %s", buf);

    ˙˙˙ Sleep(100); //wait 100 ms



    ˙ }


    }
    something like that?


    You would probably want it as a URI at least...

    Say:
    tcp://1.2.3.4:555
    tcp://[1492:0069::1]:1234
    ...


    I had considered something like this for my makeshift TestKern OS, but:
    Thus far no proper networking support;
    For an FPGA, would need to implement Ethernet, which is a big ask;
    For the emulator, would need to implement a full network stack on both
    ends to have fake Ethernet;
    ...

    Within the VFS, URI like notation is supported, and can behave in a
    similar way to mount points (could almost go as far as to mimic Windows
    drive letters, but I had gone with a a Unix style single-root filesystem
    for the main VFS, with directories as mount points).


    Given I had already tried and failed to implement working USB support on
    the FPGA, not particularly inclined to face off with Ethernet. A project
    from long ago had used PPP and a Modem, which I could emulate again, or
    use a virtual Null-Modem connection, but, ...

    In the project, IIRC there is an (internal only) network stack which
    mostly assumes IPv6 as the baseline, but then maps both IPv4 and Unix-domain-sockets through this (and would also support GUID/UUID
    through the same mechanism). Had briefly considered routing X11 over
    this, but then noted that this would be far higher hassle and overhead
    than routing Window/GUI stuff over COM.

    You can mostly use the same 128-bit space for nearly all of them, but
    with some level of mutual-exclusivity:
    SIXTEENCC and GUIDs are mutually exclusive at the encoding level;
    Heuristic means can be used to separate IPv6 addresses from the others;
    Though, for IPv6 is it weaker as there are fewer rules the IPv6
    addresses are required to follow, so one can prove that an IPv6 address
    is not a valid SIXTEENCC or a GUID, but can't prove that one of these is
    not a valid IPv6 address (unless by assuming that if it hits as one of
    these, it is probably not an IPv6).

    Though, can use different internal protocol numbers for address strength (while possibly fudging it for the internal routing).

    For Unix sockets, had used SIXTEENCC if the name was short (typical), or
    a hashed ID if longer...



    Well, and theoretically could support non-local GUI (if not implementing
    X11) by routing COM over either TCP or UDP (on a LAN setting, UDP would
    likely make more sense).

    Well, and/or eventually implement an X11 server as a wrapper.

    ...




    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Wed Jun 17 23:47:42 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Wed, 17 Jun 2026 12:13:19 -0700, Chris M. Thomasson wrote:

    On 6/16/2026 8:11 PM, Lawrence D?Oliveiro wrote:

    On Tue, 16 Jun 2026 13:08:49 -0700, Chris M. Thomasson wrote:

    On 6/15/2026 9:36 PM, Lawrence D?Oliveiro wrote:

    They seem optimized for circuit-oriented connections which
    send/receive very small amounts of data ... and unencrypted ones,
    at that. Is this a common use-case in the Windows world?

    unencrypted ones? Why should they encrypt? The user needs to do
    that before it sends anything.

    The gold-standard protocol for doing this, namely TLS, requires a
    Diffie-Hellman exchange to set up the one-off session key for the
    connection. That takes more than one packet in each direction.

    ConnectEx can optionally send data. That data is a bag o bytes.
    Encrypted or not. How one sets that up is up to them.

    Not really enough to set up an encryption session, as I said. Just
    seems optimized for circuit-oriented connections which send/receive
    small amounts of unencrypted data.

    Is this a common use-case in the Windows world?

    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Wed Jun 17 20:26:00 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/17/2026 4:47 PM, Lawrence D?Oliveiro wrote:
    On Wed, 17 Jun 2026 12:13:19 -0700, Chris M. Thomasson wrote:

    On 6/16/2026 8:11 PM, Lawrence D?Oliveiro wrote:

    On Tue, 16 Jun 2026 13:08:49 -0700, Chris M. Thomasson wrote:

    On 6/15/2026 9:36 PM, Lawrence D?Oliveiro wrote:

    They seem optimized for circuit-oriented connections which
    send/receive very small amounts of data ... and unencrypted ones,
    at that. Is this a common use-case in the Windows world?

    unencrypted ones? Why should they encrypt? The user needs to do
    that before it sends anything.

    The gold-standard protocol for doing this, namely TLS, requires a
    Diffie-Hellman exchange to set up the one-off session key for the
    connection. That takes more than one packet in each direction.

    ConnectEx can optionally send data. That data is a bag o bytes.
    Encrypted or not. How one sets that up is up to them.

    Not really enough to set up an encryption session, as I said. Just
    seems optimized for circuit-oriented connections which send/receive
    small amounts of unencrypted data.

    Is this a common use-case in the Windows world?

    Well, ConnectEx can send the initial DH exchange bytes right on connect.
    But that is up to the user... Right?

    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Thu Jun 18 07:30:06 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Wed, 17 Jun 2026 20:26:00 -0700, Chris M. Thomasson wrote:

    On 6/17/2026 4:47 PM, Lawrence D?Oliveiro wrote:

    On Wed, 17 Jun 2026 12:13:19 -0700, Chris M. Thomasson wrote:

    On 6/16/2026 8:11 PM, Lawrence D?Oliveiro wrote:

    The gold-standard protocol for doing this, namely TLS, requires a
    Diffie-Hellman exchange to set up the one-off session key for the
    connection. That takes more than one packet in each direction.

    ConnectEx can optionally send data. That data is a bag o bytes.
    Encrypted or not. How one sets that up is up to them.

    Not really enough to set up an encryption session, as I said. Just
    seems optimized for circuit-oriented connections which send/receive
    small amounts of unencrypted data.

    Is this a common use-case in the Windows world?

    Well, ConnectEx can send the initial DH exchange bytes right on connect.
    But that is up to the user... Right?

    The TLS setup exchange is diagrammed here <https://www.rfc-editor.org/info/rfc8446/#section-2>. There are three phases:

    1) Key exchange: ClientHello + ServerHello -- one message in each direction
    2) Server parameters -- two messages from server to client
    3) Authentication -- three messages in each direction.

    Hard to see how to fit all that into a single ConnectEx + AcceptEx ...

    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Thu Jun 18 07:30:55 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Wed, 17 Jun 2026 18:41:57 -0500, BGB wrote:

    (could almost go as far as to mimic Windows drive letters ...

    Oh gods, no ...


    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From BGB@3:633/10 to All on Thu Jun 18 03:49:55 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/18/2026 2:30 AM, Lawrence D?Oliveiro wrote:
    On Wed, 17 Jun 2026 18:41:57 -0500, BGB wrote:

    (could almost go as far as to mimic Windows drive letters ...

    Oh gods, no ...


    Not that there is any plan to do so...

    Just that it is also not a huge leap from:
    tcp://whatever
    udp://whatever
    http://whatever
    ftp://whatever
    ...
    To:
    c:/whatever...


    But, as noted, I was already mostly going with a Unix-like directory
    tree and mount system.

    So:
    /usr
    /usr/bin
    /usr/etc
    /dev/...
    ...

    Though, in this case, "/boot" is the actual mounted boot device
    (typically a FAT32 drive);
    With '/' as a small ramdisk, and "/dev" as a special "devfs";
    And, '/usr' was typically a prebuilt read-only VFS image.


    Some parts of the design inspired by Unix and Linux, some by Windows,
    and other parts by things like the Doom and Quake engines and similar.

    And, then some oddities, like despite nominally FAT being
    case-insensitive, TestKern treats it as case-sensitive.





    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Thu Jun 18 04:36:43 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/18/2026 12:30 AM, Lawrence D?Oliveiro wrote:
    On Wed, 17 Jun 2026 20:26:00 -0700, Chris M. Thomasson wrote:

    On 6/17/2026 4:47 PM, Lawrence D?Oliveiro wrote:

    On Wed, 17 Jun 2026 12:13:19 -0700, Chris M. Thomasson wrote:

    On 6/16/2026 8:11 PM, Lawrence D?Oliveiro wrote:

    The gold-standard protocol for doing this, namely TLS, requires a
    Diffie-Hellman exchange to set up the one-off session key for the
    connection. That takes more than one packet in each direction.

    ConnectEx can optionally send data. That data is a bag o bytes.
    Encrypted or not. How one sets that up is up to them.

    Not really enough to set up an encryption session, as I said. Just
    seems optimized for circuit-oriented connections which send/receive
    small amounts of unencrypted data.

    Is this a common use-case in the Windows world?

    Well, ConnectEx can send the initial DH exchange bytes right on connect.
    But that is up to the user... Right?

    The TLS setup exchange is diagrammed here <https://www.rfc-editor.org/info/rfc8446/#section-2>. There are three phases:

    1) Key exchange: ClientHello + ServerHello -- one message in each direction
    2) Server parameters -- two messages from server to client
    3) Authentication -- three messages in each direction.

    Hard to see how to fit all that into a single ConnectEx + AcceptEx ...

    The ConnectEx can be the ClientHello at least. ;^)

    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris M. Thomasson@3:633/10 to All on Thu Jun 18 04:38:51 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/18/2026 4:36 AM, Chris M. Thomasson wrote:
    On 6/18/2026 12:30 AM, Lawrence D?Oliveiro wrote:
    On Wed, 17 Jun 2026 20:26:00 -0700, Chris M. Thomasson wrote:

    On 6/17/2026 4:47 PM, Lawrence D?Oliveiro wrote:

    On Wed, 17 Jun 2026 12:13:19 -0700, Chris M. Thomasson wrote:

    On 6/16/2026 8:11 PM, Lawrence D?Oliveiro wrote:

    The gold-standard protocol for doing this, namely TLS, requires a
    Diffie-Hellman exchange to set up the one-off session key for the
    connection. That takes more than one packet in each direction.

    ConnectEx can optionally send data. That data is a bag o bytes.
    Encrypted or not. How one sets that up is up to them.

    Not really enough to set up an encryption session, as I said. Just
    seems optimized for circuit-oriented connections which send/receive
    small amounts of unencrypted data.

    Is this a common use-case in the Windows world?

    Well, ConnectEx can send the initial DH exchange bytes right on connect. >>> But that is up to the user... Right?

    The TLS setup exchange is diagrammed here
    <https://www.rfc-editor.org/info/rfc8446/#section-2>. There are three
    phases:

    ˙˙ 1) Key exchange: ClientHello + ServerHello -- one message in each
    direction
    ˙˙ 2) Server parameters -- two messages from server to client
    ˙˙ 3) Authentication -- three messages in each direction.

    Hard to see how to fit all that into a single ConnectEx + AcceptEx ...

    The ConnectEx can be the ClientHello at least. ;^)

    Iirc, ConnectEx sends the ClientHello on connect AcceptEx receives it on
    the server side simultaneously wrt accepting the connection...

    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Thu Jun 18 23:03:43 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Thu, 18 Jun 2026 04:36:43 -0700, Chris M. Thomasson wrote:

    On 6/18/2026 12:30 AM, Lawrence D?Oliveiro wrote:

    The TLS setup exchange is diagrammed here
    <https://www.rfc-editor.org/info/rfc8446/#section-2>. There are
    three phases:

    1) Key exchange: ClientHello + ServerHello -- one message in
    each direction
    2) Server parameters -- two messages from server to client
    3) Authentication -- three messages in each direction.

    Hard to see how to fit all that into a single ConnectEx + AcceptEx
    ...

    The ConnectEx can be the ClientHello at least. ;^)

    And what does that achieve, really?

    If saving the overhead of one system call is so significant, perhaps
    you shouldn?t be using that OS for high-performance network operations
    ...

    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Thu Jun 18 23:06:49 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Thu, 18 Jun 2026 03:49:55 -0500, BGB wrote:

    Just that it is also not a huge leap from:
    tcp://whatever
    udp://whatever
    http://whatever
    ftp://whatever
    ...
    To:
    c:/whatever...

    Yes it is.

    In the former, that part before the colon is a protocol. In the
    latter, it is now down to just indicating a filesystem drive. And not
    even in a unique fashion, like with a volume UUID or something, but
    with an arbitarily-assigned ?drive letter? which cannot be guaranteed
    to be unique or persistent.

    Remember, we already have

    file://whatever

    for denoting files on the local filesystem. That allows the ?whatever?
    part to span the entire filesystem, not just one volume/drive.

    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From BGB@3:633/10 to All on Fri Jun 19 01:20:14 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 6/18/2026 6:06 PM, Lawrence D?Oliveiro wrote:
    On Thu, 18 Jun 2026 03:49:55 -0500, BGB wrote:

    Just that it is also not a huge leap from:
    tcp://whatever
    udp://whatever
    http://whatever
    ftp://whatever
    ...
    To:
    c:/whatever...

    Yes it is.

    In the former, that part before the colon is a protocol. In the
    latter, it is now down to just indicating a filesystem drive. And not
    even in a unique fashion, like with a volume UUID or something, but
    with an arbitarily-assigned ?drive letter? which cannot be guaranteed
    to be unique or persistent.


    Well, on older Windows.

    On newer systems, the OS remembers and will assign the same drives to
    the same letter on each boot.


    But, yeah, probably wouldn't do it the Windows way. Either they could be specified as mounts (in mtab or such), or possibly treated as aliases, say:
    c:/ aliases to /mnt/c


    Though, granted, not much particular reason to do this...




    Remember, we already have

    file://whatever

    for denoting files on the local filesystem. That allows the ?whatever?
    part to span the entire filesystem, not just one volume/drive.

    Maybe, but you wouldn't need "file://" for "fopen()" or similar, since
    it is sort of an implied default in this case.


    Then again, going into the weeds on this:
    Would, say:
    cd ftp://foo.org/pub/
    ls
    Even really make sense?...

    Or, would it be better to ask people to at least mount it into the VFS
    or similar?...



    Well, or other mysteries, like, say:
    Should usermode applications be allowed to export COM-like interfaces
    that could then be mounted into the VFS?...

    Say, for example, an application exports an IFileSystem or IMount
    interface to the VFS, and then one can issue a "mount" on it. Would need
    some way for the VFS do deal gracefully if the application becomes unresponsive or crashes though (preferably without nuking the whole OS
    in the process).

    Vs, say, assuming programs that export interfaces (as services) to be at
    least semi trsusted / stable...

    Though, TODO here would still be to come up with a general mechanism for applications to export COM-like interfaces (and tag the interface, and
    have at some way to verify whether both sides agree as to the interface layout). Though, there is the trick that was used for versioning in BITMAPINFOHEADER and WAVEFORMATEX:
    Pass the sizeof the object and vtable, and use this as an informal
    version key (crap strategy, but kinda works...).


    In most other contexts, you know in advance which type of interface is expected.

    But, for some cases, could make sense to have some way for an
    application to just be like "Hey, I want to export an instance of this particular interface...".

    Say, something sorta like:
    HANDLE tkObjExportInterface(
    GUID uidClz, GUID uidIface,
    IObjectPVoid pVt,
    SIZE szVt, SIZE szDat);


    Well, which could likely spawn a new service-handler thread for this and return the handle (well, at least in TestKern, every sort of listener
    object essentially needs a thread whose sole purpose is to dispatch
    method calls that come in for that object; in effect the thread goes to
    sleep in a special state where it wakes every time a new method-call
    comes in, and goes back to sleep as soon as it returns to the caller).

    Where, say, uidClz gives a GUID or similar identifying the object
    interface type, and uidIface giving an "assumed unique" ID for the
    specific interface being exported.

    Could use strings, with a special hashing algorithm to map strings to GUID-like form (otherwise, they are either magic numbers; or "assumed
    unique" values generated with a random number generator, and some
    special tag-pattern bits). Note that (like ASLR), the GUID generation
    needs access to a moderately strong random number generator.


    May seem like a waste to burn a thread on each object listener, but no
    real better option at present.

    Though, another option could be something like, say:
    clz_someobj *obj;
    HANDLE hPub;

    obj=tkObjCreatePublicInstance(
    clz_uid_clz, &clz_someobj_iface,
    sizeof(clz_someobj_iface), sizeof(clz_someobj));
    hPub=tkObjExportInstance(obj, uid_interface);

    But, implicitly this is what "tkObjExportInterface()" could likely do internally.


    Though, generally, this sort of thing is more done for kernel-space
    stuff, not so much for userland. Userland is more often in the role as a consumer of interfaces.


    Then again, I guess one could argue:
    Maybe if userland exports an object, and the handler dies somehow, all
    the method calls simply become no ops?... (well, either this or
    terminate the caller, or do the equivalent of a kernel panic).

    Well, may need to sort this stuff out eventually.


    Note that generally the interface exported on one side is not the same
    as what the client sees. Generally the client merely sees a dummy object
    with a dummy vtable (method calls then perform system calls that route
    control to the target object).



    Well, can note that this is one area where my efforts differ somewhat
    from Linux (which mostly doesn't go here; or would more likely just use
    a sockets).

    ...


    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From David Brown@3:633/10 to All on Fri Jun 19 08:56:32 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 19/06/2026 08:20, BGB wrote:
    On 6/18/2026 6:06 PM, Lawrence D?Oliveiro wrote:
    On Thu, 18 Jun 2026 03:49:55 -0500, BGB wrote:

    Just that it is also not a huge leap from:
    ˙˙˙ tcp://whatever
    ˙˙˙ udp://whatever
    ˙˙˙ http://whatever
    ˙˙˙ ftp://whatever
    ˙˙˙ ...
    To:
    ˙˙˙ c:/whatever...

    Yes it is.

    In the former, that part before the colon is a protocol. In the
    latter, it is now down to just indicating a filesystem drive. And not
    even in a unique fashion, like with a volume UUID or something, but
    with an arbitarily-assigned ?drive letter? which cannot be guaranteed
    to be unique or persistent.


    Well, on older Windows.

    On newer systems, the OS remembers and will assign the same drives to
    the same letter on each boot.


    I am not sure what you call "newer", but IIRC Windows has done that
    since Windows 3.1. The only letters you could assign yourself were for network drives, and they were persistent if you choose "persistent=yes".

    Later versions of Windows (maybe NT4 or W2K? I can't remember the
    details) let you choose the letter to use for other drives, such as
    additional harddrives, CD-ROMs and later still, USB drives. Those
    choices were persistent.

    Automatically chosen drive letters were, of course, inconsistent. And
    when you have a lot of drives and network shares, they run out.


    But, yeah, probably wouldn't do it the Windows way. Either they could be specified as mounts (in mtab or such), or possibly treated as aliases, say:
    ˙ c:/ aliases to /mnt/c

    Drive letters make sense when users wanted to distinguish between their
    3.5" floppy "A:" and their 5.25" floppy "B:". They were still usable
    when you had a hard drive with one partition. Once it was realistic to
    have two drives in the one PC, and more than one partition on a disk,
    they were outdated and too restrictive for comfort.

    They were a product of their time, but offer nothing going forward.
    Copying the concept in any way for a new system is a daft idea.



    Though, granted, not much particular reason to do this...




    Remember, we already have

    ˙˙˙˙ file://whatever

    for denoting files on the local filesystem. That allows the ?whatever?
    part to span the entire filesystem, not just one volume/drive.

    Maybe, but you wouldn't need "file://" for "fopen()" or similar, since
    it is sort of an implied default in this case.


    Then again, going into the weeds on this:
    Would, say:
    ˙ cd ftp://foo.org/pub/
    ˙ ls
    Even really make sense?...


    That could be nice, at least for things that support a file and
    directory model. It all depends on how you want to treat user
    convenience, security, reliability, etc.

    Or, would it be better to ask people to at least mount it into the VFS
    or similar?...

    You are likely to need a user name and password here somewhere.




    Well, or other mysteries, like, say:
    Should usermode applications be allowed to export COM-like interfaces
    that could then be mounted into the VFS?...

    Say, for example, an application exports an IFileSystem or IMount
    interface to the VFS, and then one can issue a "mount" on it. Would need some way for the VFS do deal gracefully if the application becomes unresponsive or crashes though (preferably without nuking the whole OS
    in the process).

    Like "fuse" on Linux (and similar things on other systems) ? Usermode
    is the way to go for anything that is not speed critical.


    Vs, say, assuming programs that export interfaces (as services) to be at least semi trsusted / stable...


    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Fri Jun 19 06:59:33 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On Fri, 19 Jun 2026 01:20:14 -0500, BGB wrote:

    On newer [Windows], the OS remembers and will assign the same drives
    to the same letter on each boot.

    You know, it?s a wonder to think, for an OS that was supposedly
    designed for 16-bit machines, how many legacy features it inherits
    from the 8-bit era.

    Maybe, but you wouldn't need "file://" for "fopen()" or similar,
    since it is sort of an implied default in this case.

    For an OS-level call, yes. But there are lots of higher-level toolkits (particularly GUI-associated ones) that hook in a virtual-I/O layer
    that allows accessing remote URLs as easily as opening local files.

    May seem like a waste to burn a thread on each object listener, but
    no real better option at present.

    What, no event loop?

    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Keith Thompson@3:633/10 to All on Fri Jun 19 02:21:03 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    BGB <cr88192@gmail.com> writes:
    [...]
    Then again, going into the weeds on this:
    Would, say:
    cd ftp://foo.org/pub/
    ls
    Even really make sense?...

    It wouldn't work that way, because "ftp:" is a valid name for a
    directory on a Unix-like system, and "//" is equivalent to "/".

    $ cd ftp://foo.org/pub/
    $ ls
    this-is-not-an-ftp-server
    $

    Trying to be at least vaguely topical, on systems with a more
    restrictive file name syntax it might be possible for fopen() to
    distinguish by name between a local file and a URL, but not on a
    Unix-like system without more information.

    Or, would it be better to ask people to at least mount it into the VFS
    or similar?...

    It's certainly possible to mount an ftp server as a filesystem on
    most Unix-like systems, probably with some add-on software
    (like curlftpfs, which I haven't tried).

    [...]

    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    void Void(void) { Void(); } /* The recursive call of the void */

    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Bart@3:633/10 to All on Fri Jun 19 10:42:32 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 19/06/2026 07:56, David Brown wrote:
    On 19/06/2026 08:20, BGB wrote:
    On 6/18/2026 6:06 PM, Lawrence D?Oliveiro wrote:
    On Thu, 18 Jun 2026 03:49:55 -0500, BGB wrote:

    Just that it is also not a huge leap from:
    ˙˙˙ tcp://whatever
    ˙˙˙ udp://whatever
    ˙˙˙ http://whatever
    ˙˙˙ ftp://whatever
    ˙˙˙ ...
    To:
    ˙˙˙ c:/whatever...

    Yes it is.

    In the former, that part before the colon is a protocol. In the
    latter, it is now down to just indicating a filesystem drive. And not
    even in a unique fashion, like with a volume UUID or something, but
    with an arbitarily-assigned ?drive letter? which cannot be guaranteed
    to be unique or persistent.


    Well, on older Windows.

    On newer systems, the OS remembers and will assign the same drives to
    the same letter on each boot.


    I am not sure what you call "newer", but IIRC Windows has done that
    since Windows 3.1.˙ The only letters you could assign yourself were for network drives, and they were persistent if you choose "persistent=yes".

    Later versions of Windows (maybe NT4 or W2K?˙ I can't remember the
    details) let you choose the letter to use for other drives, such as additional harddrives, CD-ROMs and later still, USB drives.˙ Those
    choices were persistent.

    Automatically chosen drive letters were, of course, inconsistent.˙ And
    when you have a lot of drives and network shares, they run out.


    But, yeah, probably wouldn't do it the Windows way. Either they could
    be specified as mounts (in mtab or such), or possibly treated as
    aliases, say:
    ˙˙ c:/ aliases to /mnt/c

    Drive letters make sense when users wanted to distinguish between their
    3.5" floppy "A:" and their 5.25" floppy "B:".˙ They were still usable
    when you had a hard drive with one partition.˙ Once it was realistic to
    have two drives in the one PC, and more than one partition on a disk,
    they were outdated and too restrictive for comfort.

    How would you distinguish between two floppy drives on a Unix-like file system?

    If writing a common shell script for other people to use on their own machines, would you be able to use the same designations?



    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Dan Cross@3:633/10 to All on Fri Jun 19 10:18:13 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    In article <11132u8$37hrh$1@dont-email.me>, Bart <bc@freeuk.com> wrote:
    On 19/06/2026 07:56, David Brown wrote:
    On 19/06/2026 08:20, BGB wrote:
    On 6/18/2026 6:06 PM, Lawrence D?Oliveiro wrote:
    On Thu, 18 Jun 2026 03:49:55 -0500, BGB wrote:

    Just that it is also not a huge leap from:
    ˙˙˙ tcp://whatever
    ˙˙˙ udp://whatever
    ˙˙˙ http://whatever
    ˙˙˙ ftp://whatever
    ˙˙˙ ...
    To:
    ˙˙˙ c:/whatever...

    Yes it is.

    In the former, that part before the colon is a protocol. In the
    latter, it is now down to just indicating a filesystem drive. And not
    even in a unique fashion, like with a volume UUID or something, but
    with an arbitarily-assigned ?drive letter? which cannot be guaranteed
    to be unique or persistent.


    Well, on older Windows.

    On newer systems, the OS remembers and will assign the same drives to
    the same letter on each boot.


    I am not sure what you call "newer", but IIRC Windows has done that
    since Windows 3.1.˙ The only letters you could assign yourself were for
    network drives, and they were persistent if you choose "persistent=yes".

    Later versions of Windows (maybe NT4 or W2K?˙ I can't remember the
    details) let you choose the letter to use for other drives, such as
    additional harddrives, CD-ROMs and later still, USB drives.˙ Those
    choices were persistent.

    Automatically chosen drive letters were, of course, inconsistent.˙ And
    when you have a lot of drives and network shares, they run out.


    But, yeah, probably wouldn't do it the Windows way. Either they could
    be specified as mounts (in mtab or such), or possibly treated as
    aliases, say:
    ˙˙ c:/ aliases to /mnt/c

    Drive letters make sense when users wanted to distinguish between their
    3.5" floppy "A:" and their 5.25" floppy "B:".˙ They were still usable
    when you had a hard drive with one partition.˙ Once it was realistic to
    have two drives in the one PC, and more than one partition on a disk,
    they were outdated and too restrictive for comfort.

    How would you distinguish between two floppy drives on a Unix-like file >system?

    Based on the directory name where you mount them.

    If writing a common shell script for other people to use on their own >machines, would you be able to use the same designations?

    You don't. You parameterize it. Why would I want to restrict a
    shell script to only working with the contents of floppy disks?

    Obligatory plan 9 example:

    cpu% grep floppy /dev/drivers
    #f floppy
    cpu% ls '#f'
    '#f/fd0ctl'
    '#f/fd0disk'
    '#f/fd1ctl'
    '#f/fd1disk'
    cpu% bind -a '#f' /dev
    cpu% ls -l /dev/fd0disk
    --rw-rw---- f 0 bootes bootes 1474560 Sep 20 2021 /dev/fd0disk
    cpu% dossrv
    dossrv: serving #s/dos
    cpu% mount -c /srv/dos /n/floppy0 /dev/fd0disk
    cpu% mount -c /srv/dos /n/floppy1 /dev/fd1disk
    cpu%

    This was all wrapped up into a shell script:

    cpu% cat /bin/a:
    #!/bin/rc
    rfork e
    flop=/dev/fd0disk
    if(! test -r $flop)
    flop='#f'/fd0disk
    if(! test -f /srv/dos)
    dossrv >/dev/null </dev/null >[2]/dev/null
    unmount /n/a:>[2]/dev/null
    mount -c /srv/dos /n/a: $flop
    unmount /n/a >[2]/dev/null
    mount -c /srv/dos /n/a $flop
    cpu%

    The floppy device is built into the kernel. The names relative
    to `/n` are arbitrary; the contents of both floppies are now
    available on /n/floppy0 and /n/floppy1 respectively. `dossrv`
    is a program that implements a few variations of FAT
    filesystems.

    The key observation is that shoehorning everything into `open`
    is the wrong model; instead, conceptually splitting into
    separate `mount` and access operations simplifies and permits
    composition. Making `mount` unprivileged and allowing the user
    to control their view of the file namespace makes all of this
    natural.

    - Dan C.


    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From David Brown@3:633/10 to All on Fri Jun 19 13:46:58 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 19/06/2026 11:42, Bart wrote:
    On 19/06/2026 07:56, David Brown wrote:
    On 19/06/2026 08:20, BGB wrote:
    On 6/18/2026 6:06 PM, Lawrence D?Oliveiro wrote:
    On Thu, 18 Jun 2026 03:49:55 -0500, BGB wrote:

    Just that it is also not a huge leap from:
    ˙˙˙ tcp://whatever
    ˙˙˙ udp://whatever
    ˙˙˙ http://whatever
    ˙˙˙ ftp://whatever
    ˙˙˙ ...
    To:
    ˙˙˙ c:/whatever...

    Yes it is.

    In the former, that part before the colon is a protocol. In the
    latter, it is now down to just indicating a filesystem drive. And not
    even in a unique fashion, like with a volume UUID or something, but
    with an arbitarily-assigned ?drive letter? which cannot be guaranteed
    to be unique or persistent.


    Well, on older Windows.

    On newer systems, the OS remembers and will assign the same drives to
    the same letter on each boot.


    I am not sure what you call "newer", but IIRC Windows has done that
    since Windows 3.1.˙ The only letters you could assign yourself were
    for network drives, and they were persistent if you choose
    "persistent=yes".

    Later versions of Windows (maybe NT4 or W2K?˙ I can't remember the
    details) let you choose the letter to use for other drives, such as
    additional harddrives, CD-ROMs and later still, USB drives.˙ Those
    choices were persistent.

    Automatically chosen drive letters were, of course, inconsistent.˙ And
    when you have a lot of drives and network shares, they run out.


    But, yeah, probably wouldn't do it the Windows way. Either they could
    be specified as mounts (in mtab or such), or possibly treated as
    aliases, say:
    ˙˙ c:/ aliases to /mnt/c

    Drive letters make sense when users wanted to distinguish between
    their 3.5" floppy "A:" and their 5.25" floppy "B:".˙ They were still
    usable when you had a hard drive with one partition.˙ Once it was
    realistic to have two drives in the one PC, and more than one
    partition on a disk, they were outdated and too restrictive for comfort.

    How would you distinguish between two floppy drives on a Unix-like file system?

    To be honest, I have never come across the need. In my university days
    (with SunOS, then Solaris) the machines did not have floppies - most did
    not even have hard disks. By the time I started using Linux, at about
    the turn of the century, floppies were out of fashion.


    If writing a common shell script for other people to use on their own machines, would you be able to use the same designations?


    Filesystems are mounted on *nix systems. The exact placement of mount
    points varies, as does the extent to which attached filesystems are automounted, or the user is informed and given a choice, or mounting is manual. Different *nix systems have different habits, and in Linux it
    can vary by distro or desktop. And then administrators or users can
    have their own choices.

    Hardware is different - if I need to use a floppy these days, it would
    be via a USB floppy drive. More realistically, people would use USB
    memory sticks now. But someone might have several USB mass storage
    devices attached - I would not presume to know which they want to use
    for this script or program. So I would say the script should either
    require a path (for file / directory access - and I can't think why it
    would be limited to a floppy), or a device name (for something like a
    flash image writer). It would likely be better to have a gui or menu
    choice for some programs. Getting lists of the available block devices, mounted systems, filesystem types, etc., and detailed information about
    the devices, is not hard on Linux - but I don't know how portable that
    might be to other *nix systems.




    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Bart@3:633/10 to All on Fri Jun 19 15:29:07 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 19/06/2026 11:18, Dan Cross wrote:
    In article <11132u8$37hrh$1@dont-email.me>, Bart <bc@freeuk.com> wrote:
    On 19/06/2026 07:56, David Brown wrote:
    On 19/06/2026 08:20, BGB wrote:
    On 6/18/2026 6:06 PM, Lawrence D?Oliveiro wrote:
    On Thu, 18 Jun 2026 03:49:55 -0500, BGB wrote:

    Just that it is also not a huge leap from:
    ˙˙˙ tcp://whatever
    ˙˙˙ udp://whatever
    ˙˙˙ http://whatever
    ˙˙˙ ftp://whatever
    ˙˙˙ ...
    To:
    ˙˙˙ c:/whatever...

    Yes it is.

    In the former, that part before the colon is a protocol. In the
    latter, it is now down to just indicating a filesystem drive. And not >>>>> even in a unique fashion, like with a volume UUID or something, but
    with an arbitarily-assigned ?drive letter? which cannot be guaranteed >>>>> to be unique or persistent.


    Well, on older Windows.

    On newer systems, the OS remembers and will assign the same drives to
    the same letter on each boot.


    I am not sure what you call "newer", but IIRC Windows has done that
    since Windows 3.1.˙ The only letters you could assign yourself were for
    network drives, and they were persistent if you choose "persistent=yes". >>>
    Later versions of Windows (maybe NT4 or W2K?˙ I can't remember the
    details) let you choose the letter to use for other drives, such as
    additional harddrives, CD-ROMs and later still, USB drives.˙ Those
    choices were persistent.

    Automatically chosen drive letters were, of course, inconsistent.˙ And
    when you have a lot of drives and network shares, they run out.


    But, yeah, probably wouldn't do it the Windows way. Either they could
    be specified as mounts (in mtab or such), or possibly treated as
    aliases, say:
    ˙˙ c:/ aliases to /mnt/c

    Drive letters make sense when users wanted to distinguish between their
    3.5" floppy "A:" and their 5.25" floppy "B:".˙ They were still usable
    when you had a hard drive with one partition.˙ Once it was realistic to
    have two drives in the one PC, and more than one partition on a disk,
    they were outdated and too restrictive for comfort.

    How would you distinguish between two floppy drives on a Unix-like file
    system?

    Based on the directory name where you mount them.

    If writing a common shell script for other people to use on their own
    machines, would you be able to use the same designations?

    You don't. You parameterize it. Why would I want to restrict a
    shell script to only working with the contents of floppy disks?

    Obligatory plan 9 example:

    cpu% grep floppy /dev/drivers
    #f floppy
    cpu% ls '#f'
    '#f/fd0ctl'
    '#f/fd0disk'
    '#f/fd1ctl'
    '#f/fd1disk'
    cpu% bind -a '#f' /dev
    cpu% ls -l /dev/fd0disk
    --rw-rw---- f 0 bootes bootes 1474560 Sep 20 2021 /dev/fd0disk
    cpu% dossrv
    dossrv: serving #s/dos
    cpu% mount -c /srv/dos /n/floppy0 /dev/fd0disk
    cpu% mount -c /srv/dos /n/floppy1 /dev/fd1disk
    cpu%

    This was all wrapped up into a shell script:

    cpu% cat /bin/a:
    #!/bin/rc
    rfork e
    flop=/dev/fd0disk
    if(! test -r $flop)
    flop='#f'/fd0disk
    if(! test -f /srv/dos)
    dossrv >/dev/null </dev/null >[2]/dev/null
    unmount /n/a:>[2]/dev/null
    mount -c /srv/dos /n/a: $flop
    unmount /n/a >[2]/dev/null
    mount -c /srv/dos /n/a $flop
    cpu%

    The floppy device is built into the kernel. The names relative
    to `/n` are arbitrary; the contents of both floppies are now
    available on /n/floppy0 and /n/floppy1 respectively. `dossrv`
    is a program that implements a few variations of FAT
    filesystems.

    Machines that used floppy disks with drive letters tended to be used by non-technical members of the public.

    If I was doing technical support on the phone (which I actually did),
    what would I tell someone to type in to refer to say the leftmost of
    their two floppy drives:

    Would it actually be "/n/floppy0", or would that depend on what had been
    set up the client's specific machine? I assume it would have to be all
    in the right case too?

    The beauty of letter designations is that you just say 'type A colon';
    it doesn't matter if they do A: or a: either as those OSes tended to be case-insensitive.

    This was also long before Windows, in my case on a CP/M clone.




    The key observation is that shoehorning everything into `open`
    is the wrong model; instead, conceptually splitting into
    separate `mount` and access operations simplifies and permits
    composition. Making `mount` unprivileged and allowing the user
    to control their view of the file namespace makes all of this
    natural.

    'Mount' wasn't a thing on those machines. It was usually plug-and-play.



    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Bart@3:633/10 to All on Fri Jun 19 15:49:48 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 19/06/2026 12:46, David Brown wrote:
    On 19/06/2026 11:42, Bart wrote:
    On 19/06/2026 07:56, David Brown wrote:
    On 19/06/2026 08:20, BGB wrote:
    On 6/18/2026 6:06 PM, Lawrence D?Oliveiro wrote:
    On Thu, 18 Jun 2026 03:49:55 -0500, BGB wrote:

    Just that it is also not a huge leap from:
    ˙˙˙ tcp://whatever
    ˙˙˙ udp://whatever
    ˙˙˙ http://whatever
    ˙˙˙ ftp://whatever
    ˙˙˙ ...
    To:
    ˙˙˙ c:/whatever...

    Yes it is.

    In the former, that part before the colon is a protocol. In the
    latter, it is now down to just indicating a filesystem drive. And not >>>>> even in a unique fashion, like with a volume UUID or something, but
    with an arbitarily-assigned ?drive letter? which cannot be guaranteed >>>>> to be unique or persistent.


    Well, on older Windows.

    On newer systems, the OS remembers and will assign the same drives
    to the same letter on each boot.


    I am not sure what you call "newer", but IIRC Windows has done that
    since Windows 3.1.˙ The only letters you could assign yourself were
    for network drives, and they were persistent if you choose
    "persistent=yes".

    Later versions of Windows (maybe NT4 or W2K?˙ I can't remember the
    details) let you choose the letter to use for other drives, such as
    additional harddrives, CD-ROMs and later still, USB drives.˙ Those
    choices were persistent.

    Automatically chosen drive letters were, of course, inconsistent.
    And when you have a lot of drives and network shares, they run out.


    But, yeah, probably wouldn't do it the Windows way. Either they
    could be specified as mounts (in mtab or such), or possibly treated
    as aliases, say:
    ˙˙ c:/ aliases to /mnt/c

    Drive letters make sense when users wanted to distinguish between
    their 3.5" floppy "A:" and their 5.25" floppy "B:".˙ They were still
    usable when you had a hard drive with one partition.˙ Once it was
    realistic to have two drives in the one PC, and more than one
    partition on a disk, they were outdated and too restrictive for comfort.

    How would you distinguish between two floppy drives on a Unix-like
    file system?

    To be honest, I have never come across the need.˙ In my university days (with SunOS, then Solaris) the machines did not have floppies - most did
    not even have hard disks.˙ By the time I started using Linux, at about
    the turn of the century, floppies were out of fashion.


    If writing a common shell script for other people to use on their own
    machines, would you be able to use the same designations?


    Filesystems are mounted on *nix systems.˙ The exact placement of mount points varies, as does the extent to which attached filesystems are automounted, or the user is informed and given a choice, or mounting is manual.˙ Different *nix systems have different habits, and in Linux it
    can vary by distro or desktop.˙ And then administrators or users can
    have their own choices.

    Hardware is different - if I need to use a floppy these days, it would
    be via a USB floppy drive.˙ More realistically, people would use USB
    memory sticks now.˙ But someone might have several USB mass storage
    devices attached - I would not presume to know which they want to use
    for this script or program.˙ So I would say the script should either
    require a path (for file / directory access - and I can't think why it
    would be limited to a floppy), or a device name (for something like a
    flash image writer).˙ It would likely be better to have a gui or menu
    choice for some programs.˙ Getting lists of the available block devices, mounted systems, filesystem types, etc., and detailed information about
    the devices, is not hard on Linux - but I don't know how portable that
    might be to other *nix systems.

    If you plug in a USB pen drive on Windows, it will be under a drive
    letter, but that it is not guaranteed to be consistent, especially if
    you plug in more than one.

    So that is a problem. It would be useful, IMV, if the USB sockets were
    labeled with specific letters.

    So, what's it like under Linux: if I plug a pen drive into my RPi, then
    the files will be at:

    /media/bart/EEBEBEBEC313CA9B

    Obviously. If I try another, then it's at /media/bart/NEW (note these
    are case-sensitive), and a third was at /media/bart/0159078ED.

    I assume that 'bart' is specific to my machine, so I can't assume
    anything if, say, I wanted to hardcode a path into a program or script
    that someone else runs.






    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From David Brown@3:633/10 to All on Fri Jun 19 17:25:01 2026
    Subject: Re: this guy talks about fopen (and im thinking about fopen for network)

    On 19/06/2026 16:49, Bart wrote:
    On 19/06/2026 12:46, David Brown wrote:
    On 19/06/2026 11:42, Bart wrote:
    On 19/06/2026 07:56, David Brown wrote:
    On 19/06/2026 08:20, BGB wrote:
    On 6/18/2026 6:06 PM, Lawrence D?Oliveiro wrote:
    On Thu, 18 Jun 2026 03:49:55 -0500, BGB wrote:

    Just that it is also not a huge leap from:
    ˙˙˙ tcp://whatever
    ˙˙˙ udp://whatever
    ˙˙˙ http://whatever
    ˙˙˙ ftp://whatever
    ˙˙˙ ...
    To:
    ˙˙˙ c:/whatever...

    Yes it is.

    In the former, that part before the colon is a protocol. In the
    latter, it is now down to just indicating a filesystem drive. And not >>>>>> even in a unique fashion, like with a volume UUID or something, but >>>>>> with an arbitarily-assigned ?drive letter? which cannot be guaranteed >>>>>> to be unique or persistent.


    Well, on older Windows.

    On newer systems, the OS remembers and will assign the same drives
    to the same letter on each boot.


    I am not sure what you call "newer", but IIRC Windows has done that
    since Windows 3.1.˙ The only letters you could assign yourself were
    for network drives, and they were persistent if you choose
    "persistent=yes".

    Later versions of Windows (maybe NT4 or W2K?˙ I can't remember the
    details) let you choose the letter to use for other drives, such as
    additional harddrives, CD-ROMs and later still, USB drives.˙ Those
    choices were persistent.

    Automatically chosen drive letters were, of course, inconsistent.
    And when you have a lot of drives and network shares, they run out.


    But, yeah, probably wouldn't do it the Windows way. Either they
    could be specified as mounts (in mtab or such), or possibly treated >>>>> as aliases, say:
    ˙˙ c:/ aliases to /mnt/c

    Drive letters make sense when users wanted to distinguish between
    their 3.5" floppy "A:" and their 5.25" floppy "B:".˙ They were still
    usable when you had a hard drive with one partition.˙ Once it was
    realistic to have two drives in the one PC, and more than one
    partition on a disk, they were outdated and too restrictive for
    comfort.

    How would you distinguish between two floppy drives on a Unix-like
    file system?

    To be honest, I have never come across the need.˙ In my university
    days (with SunOS, then Solaris) the machines did not have floppies -
    most did not even have hard disks.˙ By the time I started using Linux,
    at about the turn of the century, floppies were out of fashion.


    If writing a common shell script for other people to use on their own
    machines, would you be able to use the same designations?


    Filesystems are mounted on *nix systems.˙ The exact placement of mount
    points varies, as does the extent to which attached filesystems are
    automounted, or the user is informed and given a choice, or mounting
    is manual.˙ Different *nix systems have different habits, and in Linux
    it can vary by distro or desktop.˙ And then administrators or users
    can have their own choices.

    Hardware is different - if I need to use a floppy these days, it would
    be via a USB floppy drive.˙ More realistically, people would use USB
    memory sticks now.˙ But someone might have several USB mass storage
    devices attached - I would not presume to know which they want to use
    for this script or program.˙ So I would say the script should either
    require a path (for file / directory access - and I can't think why it
    would be limited to a floppy), or a device name (for something like a
    flash image writer).˙ It would likely be better to have a gui or menu
    choice for some programs.˙ Getting lists of the available block
    devices, mounted systems, filesystem types, etc., and detailed
    information about the devices, is not hard on Linux - but I don't know
    how portable that might be to other *nix systems.

    If you plug in a USB pen drive on Windows, it will be under a drive
    letter, but that it is not guaranteed to be consistent, especially if
    you plug in more than one.

    So that is a problem. It would be useful, IMV, if the USB sockets were labeled with specific letters.


    That would be useful if you use a lot of different drives and plug them
    in and out a lot. But Windows can't handle anything like that.

    On Linux, setting up something like would be straightforward. In my
    work, I use a lot of USB serial cables, and have such a system set up so
    that when I (for example) plug one into port 3 on the hub I have on my electronics desk, it turns up as /dev/ttySerial_hub3. Doing something
    similar with usb drives would just be a few lines in a udev rules file.
    (It will look a bit like a magic incantation at first, but Google will
    lead you through it.) Sometimes I give specific names to specific
    cables independent of the physical address on the USB port tree -
    whatever is most useful for the situation.

    Compared to Windows machines with its pseudorandom system for assigning
    COM port numbers, it is a joy - especially on test machines when you
    find an old device suddenly gets COM port number 129 and the test
    software only shows a list up to COM port 128. (That is not a made-up
    story.)


    So, what's it like under Linux: if I plug a pen drive into my RPi, then
    the files will be at:

    ˙ /media/bart/EEBEBEBEC313CA9B

    Obviously. If I try another, then it's at /media/bart/NEW (note these
    are case-sensitive), and a third was at /media/bart/0159078ED.


    The names are not random - they are the filesystem labels. So if you
    have a USB stick and you have given the filesystem (vfat, ntfs, ext4,
    whatever you like) the label "Bart's files", then it will turn up with
    that directory name. If you haven't done anything to a new
    off-the-shelf drive, it will use the filesystem label provided by the manufacturer, or probably something like a serial number or block device
    UUID if the label is missing. Crucially, it will be consistent for the
    same drive (unless you rename it manually).


    I assume that 'bart' is specific to my machine, so I can't assume
    anything if, say, I wanted to hardcode a path into a program or script
    that someone else runs.


    "bart" is your username. When a user is logged on to a relatively full-featured desktop, as commonly used on Linux workstations, it is
    assumed that it is the current logged-on desktop user that has plugged
    in the device, and it is mounted in a directory private to them. Other options are easily possible if that does not fit your needs.


    --- PyGate Linux v1.5.17
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)