ModbusConnectTcp and ModbusConnectRtuOverTcp both call ModbusConnectIp to get a handle.
If the IP connection fails (e.g. times out as the device fails to respond or can't be reached) then it returns NULL.
Both the above functions fail to check the handle and try to access it immediately, causing a null pointer exception.
ModbusConnectTcp and ModbusConnectRtuOverTcp both call ModbusConnectIp to get a handle. If the IP connection fails (e.g. times out as the device fails to respond or can't be reached) then it returns NULL. Both the above functions fail to check the handle and try to access it immediately, causing a null pointer exception.