-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/nettrans.c,v 6.30 2003-11-04 08:55:47 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/nettrans.c,v 6.31 2003-11-04 09:46:02 hadaq Exp $";
#define _GNU_SOURCE
int port;
addr = inet_addr(pa);
- fprintf(stderr, "%d\n", addr);
port = htons(atoi(ep));
my->type = NetTransType_udp;
retVal = openUdp(my, addr, port, flags);
}
break;
case NetTransType_udp:
- retVal = sendto(my->fd, my->pkt, my->pktSize, 0, &my->spec.sa, socklen);
-#if 0 /* This limits the output data rate to 100 * mtuSize / s */
- {
- static int i = 0;
- if (i++ % 2 != 0) {
- struct timespec tS, *t = &tS;
- t->tv_sec = 0;
- t->tv_nsec = 020000000;
- nanosleep(t, NULL);
- }
+ for (retVal = sendto(my->fd, my->pkt, my->pktSize, 0, &my->spec.sa, socklen);
+ 0 > retVal && errno == ENOBUFS; retVal = sendto(my->fd, my->pkt, my->pktSize, 0, &my->spec.sa, socklen)
+ ) {
+ struct timespec tS, *t = &tS;
+ t->tv_sec = 0;
+ t->tv_nsec = 020000000;
+ nanosleep(t, NULL);
}
-#endif
break;
}
retVal = -1;
}
if (0 > retVal) {
- syslog(LOG_DEBUG, "sendGeneric: %s", strerror(errno));
+ syslog(LOG_DEBUG, "sendGeneric: %s (%d)", strerror(errno), errno);
}
return retVal;
}