Hi, fantastic DLL i think your project is very interesting, i've implemented your dll for a few kind of comunication, S7-200 PPI via PPI Cable, and S7-200 Ethernet via CP243 but i've a problem, with the protocol ethernet for CP243 the timeout for the communication doesn't work, to reply a command the DLL wait a time near a 20/30 second, you have a soluction for this kind of problem ? with a serial i don't have any problem beacause i can change the value for the timeout, but in the ethernet isn't possibile.
Thanks for you reply
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You have to modify the function setTimeOut() in nodave.c:
(Not a really clean solaution, but it works for me)
void setTimeOut(daveInterface * di, int tmo) {
COMMTIMEOUTS cto;
int to = tmo/1000;
#ifdef DEBUG_CALLS
LOG3("%s setTimeOut time:%d)\n",di->name ,tmo);
FLUSH;
#endif
switch(di->protocol) {
case daveProtoISOTCP: /* ISO over TCP */
case daveProtoISOTCP243: /* ISO over TCP with CP243 */
case daveProtoISOTCPR: /* ISO over TCP with Routing */
case daveProtoMPI_IBH: /* MPI with IBH NetLink MPI to ethernet gateway */
case daveProtoPPI_IBH: /* PPI with IBH NetLink PPI to ethernet gateway */
case daveProtoNLpro: /* MPI with NetLink Pro MPI to ethernet gateway */
setsockopt(di->fd.rfd, SOL_SOCKET, SO_RCVTIMEO, (char *)&to, sizeof(to));
break;
Hi, fantastic DLL i think your project is very interesting, i've implemented your dll for a few kind of comunication, S7-200 PPI via PPI Cable, and S7-200 Ethernet via CP243 but i've a problem, with the protocol ethernet for CP243 the timeout for the communication doesn't work, to reply a command the DLL wait a time near a 20/30 second, you have a soluction for this kind of problem ? with a serial i don't have any problem beacause i can change the value for the timeout, but in the ethernet isn't possibile.
Thanks for you reply
Yes, I have found this bug some time ago too.
You have to modify the function setTimeOut() in nodave.c:
(Not a really clean solaution, but it works for me)
void setTimeOut(daveInterface * di, int tmo) {
COMMTIMEOUTS cto;
int to = tmo/1000;
#ifdef DEBUG_CALLS
LOG3("%s setTimeOut time:%d)\n",di->name ,tmo);
FLUSH;
#endif
switch(di->protocol) {
case daveProtoISOTCP: /* ISO over TCP */
case daveProtoISOTCP243: /* ISO over TCP with CP243 */
case daveProtoISOTCPR: /* ISO over TCP with Routing */
case daveProtoMPI_IBH: /* MPI with IBH NetLink MPI to ethernet gateway */
case daveProtoPPI_IBH: /* PPI with IBH NetLink PPI to ethernet gateway */
case daveProtoNLpro: /* MPI with NetLink Pro MPI to ethernet gateway */
setsockopt(di->fd.rfd, SOL_SOCKET, SO_RCVTIMEO, (char *)&to, sizeof(to));
break;
default:
GetCommTimeouts(di->fd.rfd, &cto);
cto.ReadIntervalTimeout=0;
cto.ReadTotalTimeoutMultiplier=0;
cto.ReadTotalTimeoutConstant=tmo/1000;
SetCommTimeouts(di->fd.rfd,&cto);
break;
}
}
#endif
Thanks for you answer, but i have another question..
The command:
setsockopt(di->fd.rfd, SOL_SOCKET, SO_RCVTIMEO, (char *)&to, sizeof(to));
i must write only in the case
daveProtoNLpro:
or i must copy it in daveProtoISOTCP243 too ?
Because the execution, go to the daveProtoISOTCP243 case and not in daveProtoNLpro?
Thanks