diff options
author | sotech117 <michael_foiani@brown.edu> | 2023-09-23 18:25:10 -0400 |
---|---|---|
committer | sotech117 <michael_foiani@brown.edu> | 2023-09-23 18:25:10 -0400 |
commit | e3f603ff96fd434fd220459dab8d63c0516f4e54 (patch) | |
tree | 8a690b70f36943d52a5b9d31c220894952cacdb5 /client.c | |
parent | 60dc1dabef820bac6917d773e8ab2ea157e895c8 (diff) |
revert to old clinet
Diffstat (limited to 'client.c')
-rw-r--r-- | client.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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); } |