Recent

Author Topic: INET TLUDPcomponent for inter-process communications?  (Read 1364 times)

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 578
INET TLUDPcomponent for inter-process communications?
« on: November 16, 2024, 12:12:26 am »
I've been using the INet TLUDPcomponent for quite a while to communicate between multiple processors and would like to use the same component now to implement inter-process communications.  I've had no success though in trying to use it with LocalHost (IP 127.0.0.1 on my Linux box).   Has anyone had any success in doing this?  (I've been using SimpleIPC for inter-process and and TLUDP for inter-processor, but would like to just use TLUDP for everything if it can be done). 

MarkMLl

  • Hero Member
  • *****
  • Posts: 8136
Re: INET TLUDPcomponent for inter-process communications?
« Reply #1 on: November 16, 2024, 04:01:56 pm »
No, and I've junked it in favour of my own code on top of the standard sockets unit: it was too unreliable and difficult to debug.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Warfley

  • Hero Member
  • *****
  • Posts: 1856
Re: INET TLUDPcomponent for inter-process communications?
« Reply #2 on: November 16, 2024, 08:42:35 pm »
Personally I don't have that much experience with INet, but if you want to do UDP, the berkley sockets API is already not that difficult and easily usable through the sockets unit.

And if you are using trunk, you can try the new fpsockets unit which maps the berkley sockets API onto more high level pascal concepts. For how to use UDP you can just take a quick look into the test cases

If you are using linux, you may want to look at Unix Domain sockets instead, they are handled through the filesystem (virtually, nothing is written to the disk) and allow you to easily create TCP streams between different processes on the same system
« Last Edit: November 16, 2024, 08:45:34 pm by Warfley »

MarkMLl

  • Hero Member
  • *****
  • Posts: 8136
Re: INET TLUDPcomponent for inter-process communications?
« Reply #3 on: November 16, 2024, 09:21:46 pm »
The reason I used LNet initially was that I needed Telnet for a terminal emulator (to connect to the Hercules IBM mainframe emulator so I could investigate VM/CMS), and Telnet isn't sexy enough for most library developers to take seriously :-) Hence there's a slightly-modified version of LNet bundled with FPC itself.

The problem is that it's /ancient/... and that's somebody who dabbles with mainframe emulators talking. Instead of using one or more background threads- supported by just about everything later than Delphi v1- it hooks into the main event loop, and when I dove in trying to work out why a terminated server didn't release its "well known" port... well, it wasn't exactly easy and that's why I wrote my own Telnet implementation.

The people at Berkeley were pretty smart, after all that's where Wirth got his PhD so we have to give them some credit :-)

As a result the Berkeley Sockets API does its designated job pretty well: frankly, once one gets to reliable documentation and examples it's far easier to use than most of the "convenience layers" that people have tried to put on top of it: and that's particularly true for a packet-oriented protocol like UDP.

You don't need a background thread for UDP, since it's strictly packet-in/packet-out. The real weakness however it that packets can get lost or reordered: but the likelihood of that happening on an intranet let alone in the context of a single machine is negligible.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 578
Re: INET TLUDPcomponent for inter-process communications?
« Reply #4 on: November 16, 2024, 11:01:32 pm »
If you are using linux, you may want to look at Unix Domain sockets instead, they are handled through the filesystem (virtually, nothing is written to the disk) and allow you to easily create TCP streams between different processes on the same system

I built a pair of test programs using TUnixSocket in fcl-net ssockets, and as I recall they worked OK (unlike TInetSocket which would work OK if compiled as a program but not if compiled as a GUI app (which would crash if I tried to use the OnIdle function).  I don't recall why I decided TUnixSocket wasn't what I wanted.  Tried so many different approaches in the last week that I'm going blind :)

cdbc

  • Hero Member
  • *****
  • Posts: 1787
    • http://www.cdbc.dk
Re: INET TLUDPcomponent for inter-process communications?
« Reply #5 on: January 18, 2025, 10:12:34 am »
Hi Curt
If you're still looking, then maybe you should have a 'LookSee' HERE, as this might just be what you're after...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

MarkMLl

  • Hero Member
  • *****
  • Posts: 8136
Re: INET TLUDPcomponent for inter-process communications?
« Reply #6 on: January 18, 2025, 12:56:16 pm »
I suspect this xrefs to Curt's more recent https://forum.lazarus.freepascal.org/index.php/topic,69609.msg541112.html which also had MQTT as a possible solution.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

cdbc

  • Hero Member
  • *****
  • Posts: 1787
    • http://www.cdbc.dk
Re: INET TLUDPcomponent for inter-process communications?
« Reply #7 on: January 18, 2025, 03:08:38 pm »
Whooopsss, missed that one  ;D
Thanks Mark
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

 

TinyPortal © 2005-2018