summaryrefslogtreecommitdiff
path: root/testing/Lossless_UDP_testclient.c
diff options
context:
space:
mode:
Diffstat (limited to 'testing/Lossless_UDP_testclient.c')
-rw-r--r--testing/Lossless_UDP_testclient.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/testing/Lossless_UDP_testclient.c b/testing/Lossless_UDP_testclient.c
index cc12206b..0c21867d 100644
--- a/testing/Lossless_UDP_testclient.c
+++ b/testing/Lossless_UDP_testclient.c
@@ -27,7 +27,7 @@
27 27
28#define PORT 33446 28#define PORT 33446
29 29
30void printpacket(char * data, uint32_t length, IP_Port ip_port) 30void printpacket(uint8_t * data, uint32_t length, IP_Port ip_port)
31{ 31{
32 uint32_t i; 32 uint32_t i;
33 printf("UNHANDLED PACKET RECEIVED\nLENGTH:%u\nCONTENTS:\n", length); 33 printf("UNHANDLED PACKET RECEIVED\nLENGTH:%u\nCONTENTS:\n", length);
@@ -104,13 +104,13 @@ void printconnection(int connection_id)
104void Lossless_UDP() 104void Lossless_UDP()
105{ 105{
106 IP_Port ip_port; 106 IP_Port ip_port;
107 char data[MAX_UDP_PACKET_SIZE]; 107 uint8_t data[MAX_UDP_PACKET_SIZE];
108 uint32_t length; 108 uint32_t length;
109 while(receivepacket(&ip_port, data, &length) != -1) 109 while(receivepacket(&ip_port, data, &length) != -1)
110 { 110 {
111 printf("packet with length: %u\n", length); 111 printf("packet with length: %u\n", length);
112 if(rand() % 3 != 1)//add packet loss 112 //if(rand() % 3 != 1)//add packet loss
113 { 113 // {
114 if(LosslessUDP_handlepacket(data, length, ip_port)) 114 if(LosslessUDP_handlepacket(data, length, ip_port))
115 { 115 {
116 printpacket(data, length, ip_port); 116 printpacket(data, length, ip_port);
@@ -118,9 +118,9 @@ void Lossless_UDP()
118 else 118 else
119 { 119 {
120 //printconnection(0); 120 //printconnection(0);
121 printf("Received handled packet with length: %u\n", length); 121 printf("Received handled packet with length: %u\n", length);
122 } 122 }
123 } 123 // }
124 } 124 }
125 125
126 doLossless_UDP(); 126 doLossless_UDP();
@@ -136,7 +136,7 @@ int main(int argc, char *argv[])
136 exit(0); 136 exit(0);
137 } 137 }
138 138
139 char buffer[128]; 139 uint8_t buffer[512];
140 int read; 140 int read;
141 141
142 FILE *file = fopen(argv[3], "rb"); 142 FILE *file = fopen(argv[3], "rb");
@@ -175,7 +175,7 @@ int main(int argc, char *argv[])
175 175
176 176
177 //read first part of file 177 //read first part of file
178 read = fread(buffer, 1, 128, file); 178 read = fread(buffer, 1, 512, file);
179 179
180 while(1) 180 while(1)
181 { 181 {
@@ -187,7 +187,7 @@ int main(int argc, char *argv[])
187 if(write_packet(connection, buffer, read)) 187 if(write_packet(connection, buffer, read))
188 { 188 {
189 //printf("Wrote data.\n"); 189 //printf("Wrote data.\n");
190 read = fread(buffer, 1, 128, file); 190 read = fread(buffer, 1, 512, file);
191 191
192 } 192 }
193 //printf("%u\n", sendqueue(connection)); 193 //printf("%u\n", sendqueue(connection));
@@ -205,7 +205,7 @@ int main(int argc, char *argv[])
205 printf("Connecting Lost after: %llu us\n", (unsigned long long)(current_time() - timer)); 205 printf("Connecting Lost after: %llu us\n", (unsigned long long)(current_time() - timer));
206 return 0; 206 return 0;
207 } 207 }
208 c_sleep(1); 208 //c_sleep(1);
209 } 209 }
210 210
211 return 0; 211 return 0;