Thank you **god**. data[][0].addr was what I was looking for, tried to use repr
to check but it turned out unreliable and so my confusion. So **Araq** was
right, I was trying to send pointer, but I could not find from his answer where
I made it wrong.
Ok, a bit messy with the strings and your hard-coded msglen (4) etc, but here's
where I got to:
* * *
There's a couple of superfluous cast[pointer] in my original, in both send and
recv message. They were left over from developing (they have no effect because
they were just casting pointer ->
My understanding is that I **do not** send pointer but I give address of start
of memory from which pipe should send the data of bytes length. And the pipe is
to cross the processes barrier. Also I have no idea how or what could I use
from stdlib.
You send a pointer to a cstring. There is simply no way this can work because
processes do not share the same address space, for the client that's just a
meaningless number. Please use Nim's
[stdlib](http://nim-lang.org/docs/net.html) instead.
So I modified god's example. The main differrence is that server receives data
and client pushes and data should be string. Unfortunatelly after many many
hours i gave up and would like to ask you for help again. I feel I am doing
something terrible with strings and its places in memory.
server
Thank you for your reply **Krux02**, I appreciate it. Not quite there however
because what I am interested in is processes not threads and how to set up
communication between two. Also I am looking for pipes, shared memory, ffs and
differences among them, performance etc. I do not want to setup
mmierzwa, as I'm on windows, I used Windows Named Pipes (not ipc)
I adapted some example cpp code (see comments in paste) to get a basic
server->client in nim.
A bit of a simple hack (one direction messaging), but it worked for my needs.
Here's an example, inc a basic test
[server](http://past
I have written several 3D applications with GUI. Not a single time did I need
multithreading for that. Of course you need to establish some communication.
You could create two message queues for bidirectional communication, but I
think it is overkill:
var queueDirectionA: seq[Messa
> [...] any kind of sockets based package: Nim's async, nanomsg, zmq all fit. I
> would likely pick nanomsg because it seems easiest to get you started [...]
As the resident [anti-license-complexity](http://copyfree.org) zealot, I'd like
to very highly recommend standardizing on
[nanomsg](https
Could you paste your solution (the IPC part) for future reference?
Success!
Cobbled a client/server solution in windows using Named Pipes.
Gui's can now run as separate processes with events passing between them.
Thanks all, especially Mr. Ka whose links were not only interesting, but they
got me to a solution.
**pipes** \- OS specific pipes, for Posix systems this is
[https://linux.die.net/man/3/pipe](https://linux.die.net/man/3/pipe). For
Windows this called Named Pipes
[https://msdn.microsoft.com/en-us/library/windows/desktop/aa365590(v=vs.85).aspx](https://msdn.microsoft.com/en-us/library/windows/d
Thanks Ka, Varriout. Speed is not a concern as my controls gui2 is more of a
designer for the 3d objects in a design mode. (sliders to manipulate a 3d
objects size, orientation etc which I then need to pass/reflect in the opengl
gui1)
> >So its better and safer to use pipes, shared memory, fifo
Also you need to know that nanomsg is a wrapper library, so you need to handle
nanomsg shared library itself.
You could also roll your own mechanism via shared memory maps (although this
world better for fixed-length structures).
god, if you dont care about speed, you can use any library you can find in
nimble which uses sockets underneath. But sockets are not native mechanism for
any OS for inter-process communication, so there can be many troubles (like not
properly closed ports, timeouts, etc). So its better and safer
Thanks Araq, yeah, I think separate processes are better, will have a look at
nanomsg.
Hey all,
I have two Nim GUI programs running and would like to know the easiest way to
get them to communicate
Gui 1. Is 3d physics environment using opengl, all wrapped in nim, I have the
mainloop
Gui 2. Is a nim IUP gui (uses nim IUP nimble package) with panels, buttons etc
I would like the
18 matches
Mail list logo