Browse Source

Update tcp_echo example to use erlang.mk

josh rotenberg 11 years ago
parent
commit
4e5e04f668

+ 6 - 0
examples/tcp_echo/Makefile

@@ -0,0 +1,6 @@
+PROJECT = tcp_echo
+
+DEPS = ranch
+dep_ranch = pkg://ranch 0.9.0
+
+include ../../erlang.mk

+ 14 - 9
examples/tcp_echo/README.md

@@ -1,18 +1,23 @@
 Ranch TCP Echo
 ==============
 
-To compile this example you need rebar in your PATH.
-
-Type the following command:
-```
-$ rebar get-deps compile
+To build the example:
+``` bash
+$ make
 ```
 
-You can then start the Erlang node with the following command:
+To start the release in the foreground:
+
+``` bash
+$ ./_rel/bin/tcp_echo_example console
 ```
-./start.sh
+
+Then start a telnet session to port 5555:
+``` bash
+$ telnet localhost 5555
 ```
 
-Then start telnet as indicated and type in a few lines. Be
-aware that there is a timeout of 5 seconds without receiving
+Type in a few words and see them echoed back.
+
+Be aware that there is a timeout of 5 seconds without receiving
 data before the example server disconnects your session.

+ 2 - 0
examples/tcp_echo/relx.config

@@ -0,0 +1,2 @@
+{release, {tcp_echo_example, "1"}, [tcp_echo]}.
+{extended_start_script, true}.

+ 0 - 3
examples/tcp_echo/start.sh

@@ -1,3 +0,0 @@
-#!/bin/sh
-erl -pa ebin deps/*/ebin -s tcp_echo \
-	-eval "io:format(\"Run: telnet localhost 5555~n\")."