Skip to content

This is a TCP Server and distributed app example in Elixir.

Notifications You must be signed in to change notification settings

tiagodavi/tcp_distributed_app_elixir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TCP Server

This is a TCP Server and distributed app example in Elixir

  • First install dependencies with mix deps.get
  • Run tests with mix test

Running TCP Server on the console.

Open a console and start the server.

$ iex -S mix
iex> App.Server.start(4001)

The -S mix options will load your project into the current session.

Open another console and connect using telnet.

$ telnet 127.0.0.1 4001
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
This is Tiago
This is Tiago

My particular telnet client can be exited by typing ctrl + ], typing quit, and pressing Enter, but your client may require different steps.

Distributed HttpServer

Run the commands below on different terminals (The first will be the master node)

Machine A

$ iex -S mix

Machine B

$ iex -S mix

Machine C

$ iex -S mix

And so on...

Now you can visit localhost:8888 from your browser.

Use /kaboom to raise an exception and start a new process (eventually running in new machines) http://localhost:8888/kaboom

You can also try to stop the master node manually using Ctrl + C. The system should put the server to run into another node automatically.

Then try to run again on the root: http://localhost:8888

About

This is a TCP Server and distributed app example in Elixir.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages