Simple example for an Erlang client / server
Erlang
Switch branches/tags
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
.gitignore Initial commit Mar 14, 2015
LICENSE Initial commit Mar 14, 2015
LIESMICH.MD Initial commit Mar 14, 2015
README.MD Initial commit Mar 14, 2015
server.erl Initial commit Mar 14, 2015

README.MD

Simple Erlang example

German / Deutsch

This is a very simple example for an Erlang based application with a client and a server exchanging messages.

To run you need:

To execute the example:

  • Starting Erlang with erl -sname servernode.
  • Compile the server module: c(server).
  • Spawn the server: Pid = spawn(fun server:loop/0).
  • You can now send it messages like this: Pid ! "42".

Distributed messages are also easy to do:

  • Enter register(serverpid, Pid). to register the server
  • Start another Erlang process: erl -sname clientnode.
  • Enter net_kernel:connect_node(servernode@name). to set up an Erlang cluster. Change name to what the Erlang prompt on the server says. If it works correctly it returns true. -Enter {serverpid, servernode@name} ! "42". to send the server a message.