1. IPC and Shared Memory blocks
- Posted by katsmeow Sep 22, 2016
- 2184 views
I fired up Patrat's IPC client server demo using IPC.ew, and surprise-surprise, client is blocked (program flow is stopped) during the send msg process until server does some stuff and frees the handle.
And the server doesn't serve anything to anything, it just displays msgs from clients. The clients do not see each other's msgs.
Am i missing some important clues?
2. Re: IPC and Shared Memory blocks
- Posted by katsmeow Sep 22, 2016
- 2134 views
Does anyone have a bi-directional data sharing memory, to which more than two separate processes can connect, and all can read what any of them write to the shared memory?
3. Re: IPC and Shared Memory blocks
- Posted by katsmeow Sep 23, 2016
- 2128 views
The reason i think this is important enough thread to be bothering you with, is that i have found and implemented a way to extract variable names and their contents for sending to separate apps which act as plugins to the main app. It will share between apps written in Eu v3.1 and OE v4 and vice versa. You pick the vars to share with a little syntax candy when declaring them, and then your program can execute
foo = "bar"
and instantly the separate plugin would know you assigned "bar" to foo. The plugin could crash, and the app would be safe otherwise. Or, you could terminate the plugin, edit it, re-launch it, and it's part of the main application again.
But i need someone who knows windoze events and shared memory, a la
-- Windows IPC (InterProcess Communication) Library -- Version 1.0 -- Thomas Parslow (patrat)to do this sharing properly. I have various sharing channels happening, but it isn't proper, it's many memory pools. I need one shared memory handle (for now, maybe later, more handles and pools) that is bidirectional for all the code that uses it.
4. Re: IPC and Shared Memory blocks
- Posted by petelomax Sep 23, 2016
- 2102 views
While investigating something else entirely, I stumbled upon "Share Memory Between Processes" by Mario Steele/Jason Mirwald in the Archive.
No idea whether that might be of any use...
5. Re: IPC and Shared Memory blocks
- Posted by ghaberek (admin) Sep 23, 2016
- 2117 views
Does anyone have a bi-directional data sharing memory, to which more than two separate processes can connect, and all can read what any of them write to the shared memory?
ZeroMQ supports IPC and makes this type of bi-directional communication pretty straightforward.
Edit: I just noticed this: http://api.zeromq.org/2-1:zmq-ipc
The inter-process transport is currently only implemented on operating systems that provide UNIX domain sockets.
-Greg
6. Re: IPC and Shared Memory blocks
- Posted by katsmeow Sep 23, 2016
- 2076 views
While investigating something else entirely, I stumbled upon "Share Memory Between Processes" by Mario Steele/Jason Mirwald in the Archive.
No idea whether that might be of any use...
Version 1 and 2.1 Beta crash instantly with C_LONG undefined.
Version 3.3 crashes instantly with "Invalid argument type" on line 27 : xGetLastError = machine_func( 51, {kernel32, "GetLastError", {0}, C_ULONG})
But i agree, if they worked, the premise sounds great!
7. Re: IPC and Shared Memory blocks
- Posted by katsmeow Sep 23, 2016
- 2097 views
Edit: I just noticed this: http://api.zeromq.org/2-1:zmq-ipc
The inter-process transport is currently only implemented on operating systems that provide UNIX domain sockets.
-Greg
So no Windows support.
pic of Kat cussing loudly
8. Re: IPC and Shared Memory blocks
- Posted by jimcbrown (admin) Sep 23, 2016
- 2110 views
Does anyone have a bi-directional data sharing memory, to which more than two separate processes can connect, and all can read what any of them write to the shared memory?
Alas, I developed a nix-only solution for Euphoria over a decade and a half ago. It would actually be really simple though to port it to Windoze under Eu 4.x (if someone could find the interest).
ZeroMQ supports IPC and makes this type of bi-directional communication pretty straightforward.
Edit: I just noticed this: http://api.zeromq.org/2-1:zmq-ipc
The inter-process transport is currently only implemented on operating systems that provide UNIX domain sockets.
-Greg
Well, for Windoze users, there is still a way.
ZeroMQ appears to support being built under cygwin ( https://github.com/zeromq/libzmq/blob/master/README.cygwin.md , http://stackoverflow.com/questions/21017296/how-to-build-zeromq-on-windows-with-cygwin ) and cygwin appears to support unix domain sockets ( https://cygwin.com/cygwin-ug-net/highlights.html , http://stackoverflow.com/questions/23086038/what-mechanism-is-used-by-msys-cygwin-to-emulate-unix-domain-sockets , https://cygwin.com/ml/cygwin/2003-05/msg00142.html )
So, one can in fact build a version of ZeroMQ, for Windoze, using cygwin, that supports unix domain sockets. A little bit of work perhaps, but nothing too difficult for an experienced C/C coder.
9. Re: IPC and Shared Memory blocks
- Posted by katsmeow Sep 23, 2016
- 2051 views
Does anyone have a bi-directional data sharing memory, to which more than two separate processes can connect, and all can read what any of them write to the shared memory?
Alas, I developed a nix-only solution for Euphoria over a decade and a half ago. It would actually be really simple though to port it to Windoze under Eu 4.x (if someone could find the interest).
If only such an interested person had that code. Oh, hmm, the windose msg code isn't in nix.
So, one can in fact build a version of ZeroMQ, for Windoze, using cygwin, that supports unix domain sockets. A little bit of work perhaps, but nothing too difficult for an experienced C/C coder.
Alas, i am not that person. Rather than relying on a 3rd party solution, and given we already have a socks and http and irc solution, wouldn't it be better all the way around to have the IPC or the "Memory Sharing Library" working?
I did find a v3 version of the sharing lib that Jordah Ferguson released in 2002, which doesn't crash. It does not, however, have the windose msg passing wrapped to let processes know something happened and to look at the memory. That's all i know of it so far....
10. Re: IPC and Shared Memory blocks
- Posted by petelomax Sep 23, 2016
- 2049 views
Alas, I developed a nix-only solution for Euphoria over a decade and a half ago. It would actually be really simple though to port it to Windoze under Eu 4.x (if someone could find the interest).
Just being curious, are you talking of pipeio?
11. Re: IPC and Shared Memory blocks
- Posted by katsmeow Sep 23, 2016
- 2062 views
Alas, I developed a nix-only solution for Euphoria over a decade and a half ago. It would actually be really simple though to port it to Windoze under Eu 4.x (if someone could find the interest).
Just being curious, are you talking of pipeio?
But pipeio is not fully bidirectional?
Reusing the same memory would save de/allocating it as it's used, and not all interfacing needs to be bidirectional, but lets not close the door on it.
12. Re: IPC and Shared Memory blocks
- Posted by jimcbrown (admin) Sep 23, 2016
- 2050 views
Alas, I developed a nix-only solution for Euphoria over a decade and a half ago. It would actually be really simple though to port it to Windoze under Eu 4.x (if someone could find the interest).
Just being curious, are you talking of pipeio?
No, I was refering to my FakeThreads libraries:
http://openeuphoria.org/forum/m/47048.wc
http://openeuphoria.org/forum/m/72948.wc
http://openeuphoria.org/forum/m/27468.wc
It had three versions - a version using nix shared memory, a version using unix domain (file) sockets, and a version using TCP/IP. Back there Eu had no socket support so I had also wrapped a nix specific socket library.
But the last one should be easy to rewrite to use Eu4's sockets.
Oh, hmm, the windose msg code isn't in nix.
Edit (added): No, but the library used a notification system through TCP implemented through something akin to select() or poll(), making it multi-platform.
But pipeio is not fully bidirectional?
Actually, it is. The child process can read commands from stdin, and write commands to stdout. The parent process will have special file descriptors/handles to perform the other side of this communication.
I am not sure about the Windoze implementation, but on nix it's quite trivial to make it non-blocking.
13. Re: IPC and Shared Memory blocks
- Posted by katsmeow Sep 23, 2016
- 2042 views
Ok, i have two programs bidirectionally sharing memory (sending Eu objects back and forth), using
Memory Sharing Library Version: 3.0 Created by: Jason Mirwald and Mario Steele Modified by Jordah Ferguson to Share Euphoria Objects Modified by Katbut i still need to add the winmsg'ing to avoid polling the memory and etc. I am trying to figure out how it's done in
Windows IPC (InterProcess Communication) Library Version 1.0 Thomas Parslow (patrat)
EDIT: I'm stuck. Apparently,
while c_func(xGetMessage, {msg, NULL, NULL, NULL}) do -- c_proc(xTranslateMessage, {msg}) -- c_proc(xDispatchMessage, {msg}) end while
must be looping constantly. But it isn't using any cpu. Makes no sense.
14. Re: IPC and Shared Memory blocks
- Posted by katsmeow Sep 24, 2016
- 2065 views
Alllllrrrrighty, i got 3 identical apps running, each can send winmsgs to the other two, so that's almost solved. And 3 apps reading and writing to shared memory works too. And all of them can be started and shut down in any order.
So how many bytes long can a winmsg be?
And why does smta.ew smell like it is sending only one character of the actual msg at a time? Can't i send a whole url in one winmsg?