aboutsummaryrefslogtreecommitdiffstats
path: root/guide/listeners.md
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-11-12 19:27:16 +0100
committerLoïc Hoguin <[email protected]>2012-11-12 19:27:16 +0100
commit7ceb7889d54f38469889c78a3a7118e86d0dd861 (patch)
tree6e718bd5a5d88b03f52709c481f5baee01b8b623 /guide/listeners.md
parenteec2e40258becbd7fcafcbf6534890a51851f07d (diff)
downloadranch-7ceb7889d54f38469889c78a3a7118e86d0dd861.tar.gz
ranch-7ceb7889d54f38469889c78a3a7118e86d0dd861.tar.bz2
ranch-7ceb7889d54f38469889c78a3a7118e86d0dd861.zip
Fix Markdown in the guide
Diffstat (limited to 'guide/listeners.md')
-rw-r--r--guide/listeners.md38
1 files changed, 19 insertions, 19 deletions
diff --git a/guide/listeners.md b/guide/listeners.md
index 63cdf81..59aa990 100644
--- a/guide/listeners.md
+++ b/guide/listeners.md
@@ -28,21 +28,21 @@ When starting a listener, a number of different settings are required:
* A protocol handler and its associated options.
Ranch includes both TCP and SSL transport handlers, respectively
-```ranch_tcp``` and ```ranch_ssl```.
+`ranch_tcp` and `ranch_ssl`.
-A listener can be started by calling the ```ranch:start_listener/6```
-function. Before doing so however, you must ensure that the ```ranch```
+A listener can be started by calling the `ranch:start_listener/6`
+function. Before doing so however, you must ensure that the `ranch`
application is started.
-To start the ```ranch``` application:
+To start the `ranch` application:
``` erlang
ok = application:start(ranch).
```
-You are then ready to start a listener. Let's call it ```tcp_echo```. It will
+You are then ready to start a listener. Let's call it `tcp_echo`. It will
have a pool of 100 acceptors, use a TCP transport and forward connections
-to the ```echo_protocol``` handler.
+to the `echo_protocol` handler.
``` erlang
{ok, _} = ranch:start_listener(tcp_echo, 100,
@@ -51,8 +51,8 @@ to the ```echo_protocol``` handler.
).
```
-You can try this out by compiling and running the ```tcp_echo``` example in the
-examples directory. To do so, open a shell in the ```examples/tcp_echo/```
+You can try this out by compiling and running the `tcp_echo` example in the
+examples directory. To do so, open a shell in the `examples/tcp_echo/`
directory and run the following commands:
```
@@ -63,8 +63,8 @@ Listening on port 5555
You can then connect to it using telnet and see the echo server reply
everything you send to it. Then when you're done testing, you can use
-the ```Ctrl+]``` key to escape to the telnet command line and type
-```quit``` to exit.
+the `Ctrl+]` key to escape to the telnet command line and type
+`quit` to exit.
```
% telnet localhost 5555
@@ -88,8 +88,8 @@ You do not have to specify a specific port to listen on. If you give
the port number 0, or if you omit the port number entirely, Ranch will
start listening on a random port.
-You can retrieve this port number by calling ```ranch:get_port/1```. The
-argument is the name of the listener you gave in ```ranch:start_listener/6```.
+You can retrieve this port number by calling `ranch:get_port/1`. The
+argument is the name of the listener you gave in `ranch:start_listener/6`.
``` erlang
{ok, _} = ranch:start_listener(tcp_echo, 100,
@@ -109,7 +109,7 @@ used although that's a less efficient solution.
Limiting the number of concurrent connections
---------------------------------------------
-The ```max_connections``` transport option allows you to limit the number
+The `max_connections` transport option allows you to limit the number
of concurrent connections. It defaults to 1024. Its purpose is to
prevent your system from being overloaded and ensuring all the
connections are handled optimally.
@@ -121,7 +121,7 @@ connections are handled optimally.
).
```
-You can disable this limit by setting its value to the atom ```infinity```.
+You can disable this limit by setting its value to the atom `infinity`.
``` erlang
{ok, _} = ranch:start_listener(tcp_echo, 100,
@@ -131,13 +131,13 @@ You can disable this limit by setting its value to the atom ```infinity```.
```
You may not always want connections to be counted when checking for
-```max_connections```. For example you might have a protocol where both
+`max_connections`. For example you might have a protocol where both
short-lived and long-lived connections are possible. If the long-lived
connections are mostly waiting for messages, then they don't consume
much resources and can safely be removed from the count.
To remove the connection from the count, you must call the
-```ranch_listener:remove_connection/1``` from within the connection process,
+`ranch_listener:remove_connection/1` from within the connection process,
with the listener pid as the only argument.
``` erlang
@@ -145,7 +145,7 @@ ranch_listener:remove_connection(ListenerPid).
```
As seen in the chapter covering protocols, this pid is received as the
-first argument of the protocol's ```start_link/4``` callback.
+first argument of the protocol's `start_link/4` callback.
Upgrading
---------
@@ -153,7 +153,7 @@ Upgrading
Ranch allows you to upgrade the protocol options. This takes effect
immediately and for all subsequent connections.
-To upgrade the protocol options, call ```ranch:set_protocol_options/2```
+To upgrade the protocol options, call `ranch:set_protocol_options/2`
with the name of the listener as first argument and the new options
as the second.
@@ -164,7 +164,7 @@ ranch:set_protocol_options(tcp_echo, NewOpts).
All future connections will use the new options.
You can also retrieve the current options similarly by
-calling ```ranch:get_protocol_options/1```.
+calling `ranch:get_protocol_options/1`.
``` erlang
Opts = ranch:get_protocol_options(tcp_echo).