Product : ISaGRAF 3.3x / 3.4x

Date    : 20-September-2001

File    : tats0eth.c modification in case Ethernet cable is removed.htm

Subject : Modification that could be made in tats0eth.c so that the workbench can reconnect to the target if the Ethernet cable is removed and replaced.

Keywords: Ethernet - TCP/IP - workbench-target communication - eth_lec_trame - tasts0eth.c


This modification has already been done on VxWorks and OS9 by some of our customer.

It does not belong to the standard product.

If you have in your OS system library a function that corresponds to the "select()" function under VxWorks, you can implement the following modifications:

In file tasts0eth.c, function eth_lec_trame ()

change for the following code

int nb, total;                 <--- same as in orginal file
uchar size;                    <--- same as in orginal file

struct fd_set readFds; /* bit mask of fds to read from */
int width; /* number of fds on which to pend */
struct timeval timeOut; /* select time out */
int selectRet; /* select return value */

/* 5 second time out on receive */

/* Reset bits in read bit mask */
FD_ZERO (&readFds);
/* Initialize bit mask */
FD_SET (CS, &readFds);
width = CS;

total = 0;                      <--- same as in orginal file
while(total < ETH_PACKET)      <--- same as in orginal file
   /* Pend with timeout for CS to be ready */
   selectRet = select(width, &readFds, NULL, NULL, &timeOut);
   if ( (selectRet==-1) || (selectRet==0) )
      /* following line = same as in orginal file */
      nb = recv(CS, (char *)&BUFF_REC[total], (int)ETH_PACKET - total, 0);

the rest of the function is the same.


Copyright © 1996-2009 ICS Triplex ISaGRAF Inc. All rights reserved.