diff options
author | Loïc Hoguin <[email protected]> | 2013-12-07 14:08:25 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2013-12-07 14:08:25 +0100 |
commit | 0770e2893f88cd50020a621e4d3b813ff8e6c58f (patch) | |
tree | db8086ef3b68ea205f69b7582334e579ff2dd907 /examples/tcp_echo | |
parent | b0c37e853ef0600ca5b86216e427d767b6bc6126 (diff) | |
download | ranch-0770e2893f88cd50020a621e4d3b813ff8e6c58f.tar.gz ranch-0770e2893f88cd50020a621e4d3b813ff8e6c58f.tar.bz2 ranch-0770e2893f88cd50020a621e4d3b813ff8e6c58f.zip |
Fix small issues and style of the examples
Diffstat (limited to 'examples/tcp_echo')
-rw-r--r-- | examples/tcp_echo/README.md | 10 | ||||
-rw-r--r-- | examples/tcp_echo/rebar.config | 4 | ||||
-rw-r--r-- | examples/tcp_echo/src/echo_protocol.erl | 5 | ||||
-rw-r--r-- | examples/tcp_echo/src/tcp_echo.app.src | 4 | ||||
-rw-r--r-- | examples/tcp_echo/src/tcp_echo.erl | 12 |
5 files changed, 13 insertions, 22 deletions
diff --git a/examples/tcp_echo/README.md b/examples/tcp_echo/README.md index df4c6bd..d65fae5 100644 --- a/examples/tcp_echo/README.md +++ b/examples/tcp_echo/README.md @@ -1,7 +1,10 @@ -Ranch TCP Echo -============== +Ranch TCP echo example +====================== + +To try this example, you need GNU `make` and `git` in your PATH. + +To build the example, run the following command: -To build the example: ``` bash $ make ``` @@ -13,6 +16,7 @@ $ ./_rel/bin/tcp_echo_example console ``` Then start a telnet session to port 5555: + ``` bash $ telnet localhost 5555 ``` diff --git a/examples/tcp_echo/rebar.config b/examples/tcp_echo/rebar.config deleted file mode 100644 index 78300c9..0000000 --- a/examples/tcp_echo/rebar.config +++ /dev/null @@ -1,4 +0,0 @@ -{deps, [ - {ranch, ".*", - {git, "git://github.com/extend/ranch.git", "master"}} -]}. 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). |