aboutsummaryrefslogtreecommitdiff
path: root/client.c
diff options
context:
space:
mode:
authorsotech117 <michael_foiani@brown.edu>2023-09-25 13:11:59 -0400
committersotech117 <michael_foiani@brown.edu>2023-09-25 13:11:59 -0400
commit150ff61c978b7ae381d1a71953c92bf4dd5c3571 (patch)
treef24a4cf4ebbf312ca15bbd04d77386c8d2ea1329 /client.c
parent0e34f9ce017d0a9afc2b2354854a0e76019a86ec (diff)
big refactoring code. some issues with udp stream now, though. will need to fix up
Diffstat (limited to 'client.c')
-rw-r--r--client.c10
1 files changed, 5 insertions, 5 deletions
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