- printf("Connecting to coke PLC machine on '%s'\n", gsCoke_ModbusAddress);
- fprintf(stderr, "Connecting to coke PLC machine on '%s'\n", gsCoke_ModbusAddress);
+ else {
+ // Preven resource leaks
+ modbus_close(gCoke_Modbus);
+ }
+ Debug_Notice("Connecting to coke PLC machine on '%s'\n", gsCoke_ModbusAddress);