I'm on a project that involves using the serial connection (hence the Jamod) and coding I came across this
//7. Execute the transaction repeat times
//repeat =10 defined in point 1. (go to the source to read the code)
int k = 0;
do {
trans.execute();
res = (ReadInputRegistersResponse) trans.getResponse();
for (int n = 0; n < res.getWordCount(); n++) {
System.out.println("Word " + n + "=" + res.getRegisterValue(n));
}
k++;
} while (k < repeat);
[Source: http://jamod.sourceforge.net/kb/serial_master_howto.html, to really understand the question I think you guys might need to read the whole example]
My question is why does it repeat the transaction? it doesn't make any sense to me since the repeat variable is taken from the args that are placed in the main and as the tutorial says, its optional. So to sum up, why is that repeat there?
Any help will be very appreciated!