*** drv_tcp.c.org	Mon Oct  6 20:15:17 2003
--- drv_tcp.c	Tue Oct  7 14:32:58 2003
*************** static int tcp_snd_dt (int port, int can
*** 1206,1220 ****
  		}
  	}
  
! 	lg = write (tport[port].tcan[canal].sock, buf, nb);
  	if (lg == -1)
  	{
  		printf ("Error %d on socket %d\n", errno, tport[port].tcan[canal].sock);
  		perror ("write on socket");
  	}
  	else if (lg < nb)
  	{
  		printf ("Cannot write %d bytes on socket %d\n", nb - lg, tport[port].tcan[canal].sock);
  	}
  	return (TRUE);
  }
--- 1206,1230 ----
  		}
  	}
  
! 	i = 0;
! loop:
! 	lg = write (tport[port].tcan[canal].sock, &buf[i], nb);
  	if (lg == -1)
  	{
+ 		if (errno == EAGAIN)
+ 		{
+ 			sleep (1);
+ 			goto loop;
+ 		}
  		printf ("Error %d on socket %d\n", errno, tport[port].tcan[canal].sock);
  		perror ("write on socket");
  	}
  	else if (lg < nb)
  	{
  		printf ("Cannot write %d bytes on socket %d\n", nb - lg, tport[port].tcan[canal].sock);
+ 		i += lg;
+ 		nb -= lg;
+ 		goto loop;
  	}
  	return (TRUE);
  }

