Commit 8d8349b860ded6dce72f67db26f75af3a649cd34
1 parent
b89bb882
Display node and service in PI and port in IPv4 at connection
Showing
2 changed files
with
6 additions
and
2 deletions
src/modbus-tcp.c
| ... | ... | @@ -305,7 +305,7 @@ static int _modbus_tcp_connect(modbus_t *ctx) |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | if (ctx->debug) { |
| 308 | - printf("Connecting to %s\n", ctx_tcp->ip); | |
| 308 | + printf("Connecting to %s:%d\n", ctx_tcp->ip, ctx_tcp->port); | |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | addr.sin_family = AF_INET; |
| ... | ... | @@ -368,6 +368,10 @@ static int _modbus_tcp_pi_connect(modbus_t *ctx) |
| 368 | 368 | if (ai_ptr->ai_family == AF_INET) |
| 369 | 369 | _modbus_tcp_set_ipv4_options(s); |
| 370 | 370 | |
| 371 | + if (ctx->debug) { | |
| 372 | + printf("Connecting to [%s]:%s\n", ctx_tcp_pi->node, ctx_tcp_pi->service); | |
| 373 | + } | |
| 374 | + | |
| 371 | 375 | rc = _connect(s, ai_ptr->ai_addr, ai_ptr->ai_addrlen, &ctx->response_timeout); |
| 372 | 376 | if (rc == -1) { |
| 373 | 377 | close(s); | ... | ... |
tests/unit-test-client.c
| ... | ... | @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) |
| 48 | 48 | if (argc > 1) { |
| 49 | 49 | if (strcmp(argv[1], "tcp") == 0) { |
| 50 | 50 | use_backend = TCP; |
| 51 | - } else if (strcmp(argv[1], "tcppi") == 0) { | |
| 51 | + } else if (strcmp(argv[1], "tcppi") == 0) { | |
| 52 | 52 | use_backend = TCP_PI; |
| 53 | 53 | } else if (strcmp(argv[1], "rtu") == 0) { |
| 54 | 54 | use_backend = RTU; | ... | ... |