45 bool error_injector_data_enable =
false;
46 int error_injector_data_counter = 100;
47 bool error_injector_runt_enable =
false;
48 int error_injector_runt_counter = 150;
49 bool error_injector_drop_enable =
false;
50 int error_injector_drop_counter = 175;
63 delay = atoi(argv[5]);
71 speed = atoi(argv[3]);
73 bsize = atoi(argv[2]);
89 printf(
"Unable to open connection to [%s:6101]\n",
address);
92 COSMOS_USLEEP(
delay*1000000);
98 #if defined(COSMOS_WIN_OS) 99 buf1[
i] = (char)rand();
101 buf1[
i] = (char)random();
107 memcpy(&buf2[INFO_SIZE],(
const char *)buf1,
bsize-INFO_SIZE);
110 if (error_injector_data_counter-- == 0 && error_injector_data_enable)
112 buf2[500] = (uint8_t)0xf1;
113 error_injector_data_counter = 100;
115 if (error_injector_runt_counter-- == 0 && error_injector_runt_enable)
117 error_injector_runt_counter = 100;
119 if (error_injector_drop_counter-- == 0 && error_injector_drop_enable)
122 error_injector_drop_counter = 100;
128 nbytes = sendto(chan.
cudp, (
const char *)buf2,
bsize, 0, (
struct sockaddr *)&chan.
caddr,
sizeof(
struct sockaddr_in));
131 if (lsleep < 0) lsleep = 0;
132 printf(
"[%6d: %4d] %6d\r", count, nbytes, lsleep);
134 COSMOS_USLEEP(lsleep);
uint16_t packets
Definition: netperf_send.cpp:39
Agent socket using Unicast UDP.
char address[20]
Definition: netperf_send.cpp:36
int i
Definition: rw_test.cpp:37
int count
Definition: rw_test.cpp:36
#define INFO_SIZE
Definition: netperf_send.cpp:34
int iretn
Definition: rw_test.cpp:37
uint16_t delay
Definition: netperf_send.cpp:38
#define SOCKET_TALK
Talk followed by optional listen (sendto address)
Definition: socketlib.h:82
int32_t cudp
Definition: socketlib.h:120
Definition: socketlib.h:115
struct sockaddr_in caddr
Definition: socketlib.h:122
#define SOCKET_BLOCKING
Blocking Agent.
Definition: socketlib.h:78
#define AGENTRCVTIMEO
Default AGENT socket RCVTIMEO (100 msec)
Definition: agentclass.h:208
uint16_t slip_calc_crc(uint8_t *buf, uint16_t size)
Calculate CRC-16-CCITT.
Definition: sliplib.cpp:322
double currentmjd(double offset)
Current UTC in Modified Julian Days.
Definition: timelib.cpp:65
float speed
Definition: netperf_send.cpp:40
uint16_t bsize
Definition: netperf_send.cpp:37
int32_t socket_open(socket_channel *channel, NetworkType ntype, const char *address, uint16_t port, uint16_t role, bool blocking, uint32_t usectimeo, uint32_t rcvbuf, uint32_t sndbuf)
Open UDP socket.
Definition: socketlib.cpp:51
double cmjd
Definition: netperf_send.cpp:41