[fpc-pascal] Piping: high level tool? Strong types sent via pipe

Lars noreply at z505.com
Mon Oct 17 20:38:26 CEST 2016


I was thinking: pipes are useful to communicate between processes. How
about a high level communication system instead of just sending low level
strings over the pipe? For example strong typing. If you want to send an
integer over a pipe, you generally have to parse the string and ensure it
is a number being sent over the pipe and not text, etc. So instead of
everyone reinventing their own strong typing system over pipes to ensure
data is received correctly, why not have a pipe library that anyone can
use which sends strongly typed information over the pipe?

i.e. Pipe.SendInteger, Pipe.SendString,

Instead of just

writeln(pipe, 'a string') which will need to be parsed and checked.

This may be something like interprocess communication library that is
already available for FPC, I don't know. I just had a brainstorm here...
pipes remind me of sockets...if you send data over a socket you have to
parse it, deal with it... Everyone reinvents their own messaging system
instead of having a single high level tool that everyone uses.

Also nice would be:

Pipe.Send(varargs)

i.e.

Pipe.Send(integer, string, byte, anythingyouwant).

Am I just reinventing the library already available for fpc for IPC
(interprocess communication) ?

Last time I tried it (been a long time) I had some issues with duplicates
showing up when communicating over IPC.

Anyway so what I would like to do, is have one process open up a pipe, and
send strongly typed data to another process. This is almost as powerful as
having a DLL since a dll allows you to communicate code between a dll and
an exe.. But with pipes no DLL is required, just two exes. This is
extremely powerful underused mechanism to create exe or elf plugins that
communicate with a main exe/elf program.

I don't like low level piping and sockets where you have to parse data and
create your own message system: everyone reinvents the wheel instead of
having a single library to use that is high level. I think sockets
communication and pipes are the biggest case of everyone reinventing the
wheel that there is!



More information about the fpc-pascal mailing list