Commit 900aa475d31abd9db45e4fb4ce0421c837e04c71
1 parent
ffd2d691
Fix mistake in modbus_tcp_listen documentation
Showing
1 changed file
with
6 additions
and
8 deletions
doc/modbus_tcp_listen.txt
| @@ -4,7 +4,7 @@ modbus_tcp_listen(3) | @@ -4,7 +4,7 @@ modbus_tcp_listen(3) | ||
| 4 | 4 | ||
| 5 | NAME | 5 | NAME |
| 6 | ---- | 6 | ---- |
| 7 | -modbus_tcp_listen - create and listen a TCP Modbus socket | 7 | +modbus_tcp_listen - create and listen a TCP Modbus socket (IPv4) |
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | SYNOPSIS | 10 | SYNOPSIS |
| @@ -26,19 +26,17 @@ successful. Otherwise it shall return -1 and set errno. | @@ -26,19 +26,17 @@ successful. Otherwise it shall return -1 and set errno. | ||
| 26 | 26 | ||
| 27 | EXAMPLE | 27 | EXAMPLE |
| 28 | ------- | 28 | ------- |
| 29 | -For a detailed example, see source file bandwith-server-many-up.c provided in | ||
| 30 | -tests directory. | 29 | +For detailed examples, see source files in tests directory: |
| 30 | + | ||
| 31 | +- unit-test-server.c, simple but handle only one connection | ||
| 32 | +- bandwith-server-many-up.c, handles several connections at once | ||
| 33 | + | ||
| 31 | 34 | ||
| 32 | [source,c] | 35 | [source,c] |
| 33 | ------------------- | 36 | ------------------- |
| 34 | ... | 37 | ... |
| 35 | 38 | ||
| 36 | ctx = modbus_new_tcp("127.0.0.1", 502); | 39 | ctx = modbus_new_tcp("127.0.0.1", 502); |
| 37 | -if (modbus_connect(ctx) == -1) { | ||
| 38 | - fprintf(stderr, "Connection failed: %s\n", modbus_strerror(errno)); | ||
| 39 | - modbus_free(ctx); | ||
| 40 | - return -1; | ||
| 41 | -} | ||
| 42 | 40 | ||
| 43 | /* Handle until 10 established connections */ | 41 | /* Handle until 10 established connections */ |
| 44 | server_socket = modbus_tcp_listen(ctx, 10); | 42 | server_socket = modbus_tcp_listen(ctx, 10); |