Skip to content

ewolff/erlang-example

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

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.

About

Simple example for an Erlang client / server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages