aboutsummaryrefslogtreecommitdiffstats
path: root/examples/tcp_echo/src
diff options
context:
space:
mode:
Diffstat (limited to 'examples/tcp_echo/src')
-rw-r--r--examples/tcp_echo/src/echo_protocol.erl5
-rw-r--r--examples/tcp_echo/src/tcp_echo.app.src4
-rw-r--r--examples/tcp_echo/src/tcp_echo.erl12
3 files changed, 6 insertions, 15 deletions
diff --git a/examples/tcp_echo/src/echo_protocol.erl b/examples/tcp_echo/src/echo_protocol.erl
index 85ea289..5ed79b3 100644
--- a/examples/tcp_echo/src/echo_protocol.erl
+++ b/examples/tcp_echo/src/echo_protocol.erl
@@ -1,7 +1,10 @@
%% Feel free to use, reuse and abuse the code in this file.
-module(echo_protocol).
--export([start_link/4, init/4]).
+-behaviour(ranch_protocol).
+
+-export([start_link/4]).
+-export([init/4]).
start_link(Ref, Socket, Transport, Opts) ->
Pid = spawn_link(?MODULE, init, [Ref, Socket, Transport, Opts]),
diff --git a/examples/tcp_echo/src/tcp_echo.app.src b/examples/tcp_echo/src/tcp_echo.app.src
index 103fd56..af50890 100644
--- a/examples/tcp_echo/src/tcp_echo.app.src
+++ b/examples/tcp_echo/src/tcp_echo.app.src
@@ -1,10 +1,10 @@
%% Feel free to use, reuse and abuse the code in this file.
{application, tcp_echo, [
- {description, "Ranch TCP Echo example."},
+ {description, "Ranch TCP echo example."},
{vsn, "1"},
{modules, []},
- {registered, []},
+ {registered, [tcp_echo_sup]},
{applications, [
kernel,
stdlib,
diff --git a/examples/tcp_echo/src/tcp_echo.erl b/examples/tcp_echo/src/tcp_echo.erl
deleted file mode 100644
index 46d31da..0000000
--- a/examples/tcp_echo/src/tcp_echo.erl
+++ /dev/null
@@ -1,12 +0,0 @@
-%% Feel free to use, reuse and abuse the code in this file.
-
--module(tcp_echo).
-
-%% API.
--export([start/0]).
-
-%% API.
-
-start() ->
- ok = application:start(ranch),
- ok = application:start(tcp_echo).