I am using the libnodave
library to communicate with a Siemens S7 PLC. It works fine, until I try to write bytes. I almost always times out.
The code I have to connect:
fds.rfd = libnodave.openSocket(port, address.ToString());
fds.wfd = fds.rfd;
if (fds.rfd > 0) {
di = new libnodave.daveInterface(fds, "IF1", 0, libnodave.daveProtoISOTCP, libnodave.daveSpeed187k);
di.setTimeout(10000000);
dc = new libnodave.daveConnection(di, 0, 0, 2);
if (0 == dc.connectPLC()) {
_status.connected = true;
}
}
and to write the bytes (in another method, called in a later stage):
dc.writeBytes(libnodave.daveDB, datablock, address, bytestowrite, buftosend);
which almost always returns -1025 (timeout).
Changing the timeout, or moving the connect routine directly before the writing has no effect.