stephane/libmodbus — Issue #32: tcp_new requires a node address, _listen method doesn't want it
Author: karlp
Created: 2011-10-14 18:24:40+00:00
State: open

In modbus_new_tcp_pi(), (I haven't looked at the regular version), the following code is used to set up the hostname of the remote server: https://github.com/stephane/libmodbus/blob/master/src/modbus-tcp.c#L701

ret_size = strlcpy(ctx_tcp_pi->node, node, dest_size);

Then in `modbus_tcp_pi_listen` there is a check no the node element being 0, which then properly sets up the socket to listen on NULL, for any address. https://github.com/stephane/libmodbus/blob/master/src/modbus-tcp.c#L435

However, given the way the check is done in new(), there's no way to set the node to a zero value. I suggest that if the incoming node is NULL, that it be set to zero,