From 150ff61c978b7ae381d1a71953c92bf4dd5c3571 Mon Sep 17 00:00:00 2001 From: sotech117 Date: Mon, 25 Sep 2023 13:11:59 -0400 Subject: big refactoring code. some issues with udp stream now, though. will need to fix up --- client.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'client.c') diff --git a/client.c b/client.c index 7b9e036..4c3573c 100644 --- a/client.c +++ b/client.c @@ -21,7 +21,7 @@ void *command_line_routine(void *args); -int handle_handshake(int sockfd, char* udpPort); +u_int16_t handle_handshake(int sockfd, char* udpPort); int station_is_set = 0; int l = 0; @@ -272,7 +272,7 @@ void *command_line_routine(void* args) { // convert input to an int int inputInt = atoi(input); if (input[0] != '0' && inputInt == 0) { - printf("unknown command: %s\n", input); + printf("unknown command: %si", input); printf("snowcast_control> "); fflush(stdout); continue; @@ -300,8 +300,8 @@ void *command_line_routine(void* args) { return (NULL); } -int handle_handshake(int sockfd, char* udp_port) { - apply_timeout(sockfd); +uint16_t handle_handshake(int sockfd, char* udp_port) { + apply_timeout(sockfd); // apply timeout for handshake if (l) printf("found server, sending HELLO command. waiting for ANNOUNCE reply.\n"); @@ -333,7 +333,7 @@ int handle_handshake(int sockfd, char* udp_port) { if (l) printf("received ANNOUNCE reply.\n"); + // remove timeout since we no longer are "waiting" for an immediate reply remove_timeout(sockfd); - return ntohs(num_stations); } \ No newline at end of file -- cgit v1.2.3-70-g09d2