aboutsummaryrefslogtreecommitdiff
path: root/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'client.c')
-rw-r--r--client.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/client.c b/client.c
index 5d98dd6..81342b6 100644
--- a/client.c
+++ b/client.c
@@ -1,3 +1,4 @@
+
/*
** client.c -- a stream socket client demo
*/
@@ -84,14 +85,15 @@ int main(int argc, char *argv[])
inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr),
s, sizeof s);
+ // printf("client: connecting to %s\n", s);
freeaddrinfo(servinfo); // all done with this structure
- // sleep(1);
-
pthread_t reply_thread;
pthread_create(&reply_thread, NULL, reply_thread_routine, (void*)sockfd);
+ usleep(1000);
+
struct Hello hello;
hello.commandType = 0;
// convert updPort to an int
@@ -104,7 +106,9 @@ int main(int argc, char *argv[])
// CONSIDER: could recieve the welcome message here
+
char input[LINE_MAX];
+ printf("Enter a number to change to it's station. Click q to end stream.\n");
while (1) {
char *line = fgets(input, LINE_MAX, stdin);
@@ -155,8 +159,7 @@ void *reply_thread_routine(void* args) {
exit(1);
}
num_stations = ntohs(num_stations);
- printf("The server has %u stations.\n", num_stations);
- // printf("Enter a number to change to it's station. Click q to end stream.\n");
+ printf("Welcome to Snowcast! The server has %d stations.\n", num_stations);
continue;
}
@@ -198,7 +201,7 @@ void *reply_thread_routine(void* args) {
exit(1);
}
- printf("Lost connection to server. Exiting.\n");
+ printf("Lost connection to server. Exiting.");
close(sockfd);
exit(1);
}