Hello Imants,
In networks that support IP multicast there is an example using the
simplelocalnet backend [1].
For other networks, I couldn't find an example available, but the
nodes can be started as in [2]. This later example does not show how
to talk to a remote node, but it is a matter of starting the program
on two nodes and giving to one of the nodes the NodeId of the other. A
crude way to create a node id with the tcp transport is:
NodeId (encodeEndPointAddress "ipaddress" "port" 0)
where encodeEndPointAddress comes from [3]. It takes an endpoint id
that increases sequentially for every endpoint created with the tcp
transport. For things to go smooth it is necessary that the ip address
matches exactly the ip address that was used to create the transport
on the remote node.
The example you are asking would be a great contribution to the
website documentation. I might write one eventually if no one
contributes it earlier.
Hope it helps,
Facundo
[1]
http://hackage.haskell.org/package/distributed-process-simplelocalnet-0.2.3.3/docs/Control-Distributed-Process-Backend-SimpleLocalnet.html
[2]
http://haskell-distributed.github.io/tutorials/1ch.html#sending-messages
[3]
http://hackage.haskell.org/package/network-transport-tcp-0.5.1/docs/Network-Transport-TCP.html#v:encodeEndPointAddress
On Wed, Dec 7, 2016 at 7:23 AM, Imants Cekusins <
ima...@gmail.com> wrote:
> Hello Facundo,
>
> Sorry to bother you.
>
> I spent a few days looking at distributed-process libs, a few tutorials,
> code in Parallel and Concurrent Haskell.
>
> However I still can not figure out how to run basic code:
>
> open listening TCP socket
> start a node
> connect to another similar node (same or another server, known host & port)
> with tcp
> exchange hello messages via Process
>
>
> It is possible that everyone else but me knows how to code this, and for
> this reason examples of how to do just this are not part of the tutorials.
>
> I am able to run custom tcp client / server outside of distributed-process
> framework. I am also familiar with Erlang OTP. However can not figure out
> how to do this in a Process.
>
> Is there any chance you could give such an example? Ideally this would be
> p2p example (no master / slave config)
>
> Thank you kindly.