• How do I create an IPC alike ws2_32 ?

    From R.Wieser@21:1/5 to All on Fri Jun 24 19:46:04 2022
    Hello all,

    For quite some time now I've been looking for a way to have multiple, random programs communicate with a single program (which sends/receives data
    to/from an RS232 connection, in a way similar to TCP).

    For that I need to be able to open a connection to send/receive data, but
    also be able to listen for incoming connections from the other side (and
    hand them of to whatever program is listening for them).

    The problem is that I can't seem to figure out to let multiple, random
    programs communicate with the single program which allows the above.

    I've been looking at several IPC methods (including using a TCP/IP
    connection over 127.0.0.1), but none of them seem to allow for the
    'listening' part.

    tl;dr:
    I'm looking for a userland method which emulates the inter-process communication(?) ws2_32 / winsock uses. If someone knows about a website
    which has information about it or has information otherwise I would be much obliged.

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Charlie Gibbs@21:1/5 to R.Wieser on Fri Jun 24 21:20:52 2022
    On 2022-06-24, R.Wieser <address@not.available> wrote:

    Hello all,

    For quite some time now I've been looking for a way to have multiple,
    random programs communicate with a single program (which sends/receives
    data to/from an RS232 connection, in a way similar to TCP).

    For that I need to be able to open a connection to send/receive data,
    but also be able to listen for incoming connections from the other side
    (and hand them of to whatever program is listening for them).

    If I understand you correctly, I've written several programs that
    perform similar functions, i.e. listen for incoming TCP/IP connections
    and pass data back and forth to an RS-232 port.

    The problem is that I can't seem to figure out to let multiple, random programs communicate with the single program which allows the above.

    I've been looking at several IPC methods (including using a TCP/IP
    connection over 127.0.0.1), but none of them seem to allow for the 'listening' part.

    You can accept() a TCP/IP connection on a port on which you're
    listen()ing, and continue to listen for additional connections.
    Be sure to specify a value larger than 1 for the second argument
    to listen(), in case multiple connection attempts happen before
    you have time to accept them all. Each connection gets a unique
    socket handle so you can keep everything separate.

    --
    /~\ Charlie Gibbs |
    \ / <cgibbs@kltpzyxm.invalid> | I used to be indecisive,
    X I'm really at ac.dekanfrus | but now I'm not so sure.
    / \ if you read it the right way. |

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From JJ@21:1/5 to R.Wieser on Sat Jun 25 14:44:24 2022
    On Sat, 25 Jun 2022 09:16:31 +0200, R.Wieser wrote:

    Not quite.

    The only place TCP/IP has in this is the similarity of the datablocks going over the eithernet / serial connection, and that I would like to be able to connect to a serial connection in the same way as WS2_32 / winsock API
    allows it for an ethernet one.

    IOW, the mentioning of TCP, IP and related is just for comparisions sake.

    In a nutshell:

    My target is to be able to write (a DLL which would allow) multiple programs to open multiple connections over a single serial port.

    If it where for only a polling read- and write a datablock it would not be much of a problem. What started to be one is that I would like to be able
    to "listen" for incoming serial connections - initiated by programs which connect to a "gatekeeper" (multiplexer) serial port handler.

    Regards,
    Rudy Wieser

    Isn't that kind of like how PPP work? Something like "TCP/IP over serial
    port"? Like how dial-up modem work?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From JJ@21:1/5 to R.Wieser on Sat Jun 25 14:31:57 2022
    On Fri, 24 Jun 2022 19:46:04 +0200, R.Wieser wrote:
    Hello all,

    For quite some time now I've been looking for a way to have multiple, random programs communicate with a single program (which sends/receives data
    to/from an RS232 connection, in a way similar to TCP).

    For that I need to be able to open a connection to send/receive data, but also be able to listen for incoming connections from the other side (and
    hand them of to whatever program is listening for them).

    The problem is that I can't seem to figure out to let multiple, random programs communicate with the single program which allows the above.

    Is Named Pipe not applicable? It's basically an UDP wrapper/helper, but for small traffic data.

    I've been looking at several IPC methods (including using a TCP/IP
    connection over 127.0.0.1), but none of them seem to allow for the 'listening' part.

    TCP only allow specific IP and port to be bound by one listener. UDP doesn't have this restriction, but unless it's bound to a multicast IP, only one listener will receive (and hog) data for itself and the rest won't receive
    any. Multiple localhost listeners of the same port number, should be bound a unique local IP address. e.g. 127.0.0.1, 127.0.0.2, ... 127.0.1.1,
    127.0.1.2, etc.

    tl;dr:
    I'm looking for a userland method which emulates the inter-process communication(?) ws2_32 / winsock uses. If someone knows about a website which has information about it or has information otherwise I would be much obliged.

    Are you trying to avoid using WinSock?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Sat Jun 25 09:16:31 2022
    Charlie,

    If I understand you correctly, I've written several programs
    that perform similar functions, i.e. listen for incoming TCP/IP
    connections and pass data back and forth to an RS-232 port.

    Not quite.

    The only place TCP/IP has in this is the similarity of the datablocks going over the eithernet / serial connection, and that I would like to be able to connect to a serial connection in the same way as WS2_32 / winsock API
    allows it for an ethernet one.

    IOW, the mentioning of TCP, IP and related is just for comparisions sake.

    In a nutshell:

    My target is to be able to write (a DLL which would allow) multiple programs
    to open multiple connections over a single serial port.

    If it where for only a polling read- and write a datablock it would not be
    much of a problem. What started to be one is that I would like to be able
    to "listen" for incoming serial connections - initiated by programs which connect to a "gatekeeper" (multiplexer) serial port handler.

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Sat Jun 25 10:27:26 2022
    JJ,

    Is Named Pipe not applicable? It's basically an UDP wrapper/helper,
    but for small traffic data.

    For straight-forward reading or writing it might be/is. The problem starts when I need to listen to incoming connection requests (a-la "listen" in
    TCP/IP parlance) and have to respond apropriatily.

    TCP only allow specific IP and port to be bound by one listener.

    I'm not sure how you came to the conclusion I might be thinking otherwise
    ...

    And two things :

    1) My problem is /how/ to create a "listening" method for a serial port connection and the program which wants to be able to do so.

    2) If circumstances dictate it /I just might/ write a multi-casting
    listening solution (probably going thru multiple programs listening on the
    same port until I find one which will accept the connection). :-)

    Are you trying to avoid using WinSock?

    Nope. I'm trying to avoid using ethernet.

    Reason ? I've got a number of machines which are behind their own LAN "modems", effectivily blocking any communication between them (and want to
    keep it that way).

    Where an ethernet connection is a data highway up for grabs by whatever "services" (known but especially the unknown ones) might run on either or
    both of the Windows machines, a serial connection doesn't suffer from
    anything like it.

    ... and I could use a simple serial connection on a few DOS machines I still have (to be able to save/load files and perhaps even sync the time).

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Sat Jun 25 11:59:56 2022
    JJ,

    Isn't that kind of like how PPP work? Something like "TCP/IP over
    serial port"? Like how dial-up modem work?

    I think you're looking at the wrong part of the equation there.

    AFAIK PPP is just a simple, rather dumb driver which wraps the datablocks it than puts onto the serial connection and unwraps the received ones - which
    it gets or delivers to the TCP/IP stack software. It doesn't do anything in regard to managing requests toward multiple datastream connections from/to multiple programs.


    My problem isn't the serial connection or how to serialize the datablocks,
    but how to allow multiple programs to access it at the same time. I know I will need a "gate keeper" (multiplexer) program for that.

    The whole problem is how to have that "gate keeper" program communicate with other programs (and vice verse) which want to use the serial connection.

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul N@21:1/5 to R.Wieser on Sat Jun 25 05:15:57 2022
    On Saturday, June 25, 2022 at 11:00:12 AM UTC+1, R.Wieser wrote:
    JJ,
    Isn't that kind of like how PPP work? Something like "TCP/IP over
    serial port"? Like how dial-up modem work?
    I think you're looking at the wrong part of the equation there.

    AFAIK PPP is just a simple, rather dumb driver which wraps the datablocks it than puts onto the serial connection and unwraps the received ones - which it gets or delivers to the TCP/IP stack software. It doesn't do anything in regard to managing requests toward multiple datastream connections from/to multiple programs.


    My problem isn't the serial connection or how to serialize the datablocks, but how to allow multiple programs to access it at the same time. I know I will need a "gate keeper" (multiplexer) program for that.

    The whole problem is how to have that "gate keeper" program communicate with other programs (and vice verse) which want to use the serial connection.

    So is the idea that you have a program X. Other programs can tell X to transmit some data and it does so. Other programs can also ask X to tell them if it receives certain data, and if and when such data turns up you want X to tell the program so?

    I think this basic idea is called the "Observer" pattern.

    I think you are asking primarily about how the programs actually communicate. I found this https://docs.microsoft.com/en-us/windows/win32/dataxchg/about-dynamic-data-exchange which may be of use (I've never done anything of the sort myself!) Though this
    page does suggest that you can simply send a message from one program to another, which might do what you want. You just need for the other programs to specify what data they are interested in, and provide a "callback" message for X to send when it turns
    up.

    Hope this is in some way helpful!
    Paul.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Sat Jun 25 15:27:01 2022
    Paul,

    I think you are asking primarily about how the programs actually
    communicate.

    Yep.

    I found this https://docs.microsoft.com/en-us/windows/win32/dataxchg/about-dynamic-data-exchange
    which may be of use

    I thought the same when I found it, upto the moment I realized that it needs
    a messagepump running (read: a window of sorts) to be able to use it.
    Although I definitily see that happen for the "server" part, my "client"
    parts will, at least for starters, likely be console ones.

    Though this page does suggest that you can simply send a message from
    one program to another, which might do what you want.

    Thats another part of the problem : its not a p2p connection, but a "shared memory" one. Which IIRC could be picked up - and interfered with! - by any random other program.

    Hope this is in some way helpful!

    It is. I had all but forgotten about its existence. :-)

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)