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.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/testing/Lossless_UDP_testclient.c b/testing/Lossless_UDP_testclient.c
index d5fb1544..564b2ecf 100644
--- a/testing/Lossless_UDP_testclient.c
+++ b/testing/Lossless_UDP_testclient.c
@@ -66,8 +66,7 @@ void printpacket(uint8_t *data, uint32_t length, IP_Port ip_port)
66 66
67void printip(IP_Port ip_port) 67void printip(IP_Port ip_port)
68{ 68{
69 printf("\nIP: %u.%u.%u.%u Port: %u", ip_port.ip.uint8[0], ip_port.ip.uint8[1], ip_port.ip.uint8[2], ip_port.ip.uint8[3], 69 printf("\nIP: %s Port: %u", ip_ntoa(&ip_port.ip), ntohs(ip_port.port));
70 ntohs(ip_port.port));
71} 70}
72/* 71/*
73void printpackets(Data test) 72void printpackets(Data test)
@@ -152,6 +151,9 @@ void printconnection(int connection_id)
152 151
153int main(int argc, char *argv[]) 152int main(int argc, char *argv[])
154{ 153{
154 /* let use decide by cmdline: TODO */
155 uint8_t ipv6enabled = TOX_ENABLE_IPV6_DEFAULT;
156
155 if (argc < 4) { 157 if (argc < 4) {
156 printf("usage: %s ip port filename\n", argv[0]); 158 printf("usage: %s ip port filename\n", argv[0]);
157 exit(0); 159 exit(0);
@@ -169,13 +171,17 @@ int main(int argc, char *argv[])
169 /* initialize networking */ 171 /* initialize networking */
170 /* bind to ip 0.0.0.0:PORT */ 172 /* bind to ip 0.0.0.0:PORT */
171 IP ip; 173 IP ip;
172 ip.uint32 = 0; 174 ip_init(&ip, ipv6enabled);
175
173 Lossless_UDP *ludp = new_lossless_udp(new_networking(ip, PORT)); 176 Lossless_UDP *ludp = new_lossless_udp(new_networking(ip, PORT));
174 perror("Initialization"); 177 perror("Initialization");
178
175 IP_Port serverip; 179 IP_Port serverip;
176 serverip.ip.uint32 = inet_addr(argv[1]); 180 ip_init(&serverip.ip, ipv6enabled);
181 addr_resolve(argv[1], &serverip.ip);
177 serverip.port = htons(atoi(argv[2])); 182 serverip.port = htons(atoi(argv[2]));
178 printip(serverip); 183 printip(serverip);
184
179 int connection = new_connection(ludp, serverip); 185 int connection = new_connection(ludp, serverip);
180 uint64_t timer = current_time(); 186 uint64_t timer = current_time();
181 187