Skip to content

Commit f3461cf

Browse files
committed
detail in example
1 parent 075ad08 commit f3461cf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: examples/echo.ml

+3-1
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,20 @@ let setup_upload server : unit =
134134
let () =
135135
let port_ = ref 8080 in
136136
let j = ref 32 in
137+
let addr = ref "127.0.0.1" in
137138
Arg.parse
138139
(Arg.align
139140
[
140141
"--port", Arg.Set_int port_, " set port";
141142
"-p", Arg.Set_int port_, " set port";
142143
"--debug", Arg.Unit setup_logging, " enable debug";
143144
"-j", Arg.Set_int j, " maximum number of connections";
145+
"--addr", Arg.Set_string addr, " binding address";
144146
])
145147
(fun _ -> raise (Arg.Bad ""))
146148
"echo [option]*";
147149

148-
let server = Tiny_httpd.create ~port:!port_ ~max_connections:!j () in
150+
let server = Tiny_httpd.create ~addr:!addr ~port:!port_ ~max_connections:!j () in
149151

150152
Tiny_httpd_camlzip.setup ~compress_above:1024 ~buf_size:(16 * 1024) server;
151153
let m_stats, get_stats = middleware_stat () in

0 commit comments

Comments
 (0)