In a C# application I have this code:
for (var i = 0; i < 10; i++)
{
try
{
var op = operators[i]; // retrieve data
plc.Modbus.WriteSingleRegister(MODBUS_TABLE_OP + i * 2, op.Id);
plc.Modbus.WriteSingleRegister(MODBUS_TABLE_OP + i * 2 + 1, op.Password);
}
catch (Exception ex)
{
Logger.Error("Error: {0}", ex);
throw;
}
}
Where Modbus is an EasyModbus
instance, and Id
and Password
are type int
limited by software to 16-bit (i.e. op.Id = value & 0xFFFF
).
The code always ran fine, but since few days on the production machine after 4 or 5 iterations an exception is caught. This now happens every time the code runs. The exception message is:
Impossibile scrivere dati sulla connessione di trasporto: Connessione interrotta dal software del computer host
Unfortunately the production machine is set to Italian and I cannot change this setting. Nor I can run the code in debug mode on the production machine. Anyway, the most literal translation in English is:
Unable to write data on the transport connection: The connection was interrupted by the host computer software
I have difficult to understand the message itself, both in Italian and in English:
what does
host computer
mean in this context? The local machine (where the C# application runs) or the remote one?what does
software
mean in this context? My software or a 'generic' one, like libraries or even the OS?
Without understanding these meanings I'm not able to figure out what has changed and where.
Update
Right know I can have the log of i
and the op
fields:
i op.Id op.Password
0 2 1111
1 5 1112
2 6 8765
3 7 0000
4 9 7877
// -> disconnection