Skip to content

Commit

Permalink
Enhance README
Browse files Browse the repository at this point in the history
  • Loading branch information
Zert committed Jan 22, 2013
1 parent f592dcb commit fc37c43
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ Header is: `| Node name | Port of node | File descriptor of node connection

# Go-node #

## in progress... ##

[External Term Format](http://www.erlang.org/doc/apps/erts/erl_ext_dist.html)

[Distribution Protocol](http://www.erlang.org/doc/apps/erts/erl_dist_protocol.html)

Source of `otp/lib/kernel/src/dist_util.erl`

Run eclus with embedded node:

```sh
Expand All @@ -61,6 +53,8 @@ Then run Erlang node with the same cookie:
$ erl -sname asd@localhost -setcookie 123asd
```

## Ping ##

Now type `net_adm:ping(epmd@localhost).` in Erlang node:

```erlang
Expand All @@ -69,3 +63,26 @@ Now type `net_adm:ping(epmd@localhost).` in Erlang node:
```

You see `pong` reply from Go-node!

## Implement your own GenServer ##

See `src/eclus/esrv.go`. It is GenServer behaviour implementation which you can use like original `gen_server` process from Erlang/OTP.

To run this process first create pointer to structure which implements all methods for this behaviour:

```go
eSrv := new(eclusSrv)
```

Then call `Spawn` method on published node:

```go
enode.Spawn(eSrv)
```

Now you can interact with this process from Erlang-node using `gen_server:call/2`, gen_server:cast/2` or just send message to it:

```erlang
(asd@localhost)3> gen_server:call({eclus, epmd@localhost}, message).
{ok,eclus_reply,message}
```

0 comments on commit fc37c43

Please sign in to comment.