diff options
-rw-r--r-- | client.c | 4 | ||||
-rwxr-xr-x | snowcast_server | bin | 34476 -> 34476 bytes | |||
-rw-r--r-- | snowcast_server.c | 7 |
3 files changed, 9 insertions, 2 deletions
@@ -113,12 +113,14 @@ int main(int argc, char *argv[]) if (line == NULL) { continue; } else if (strncmp("q\n", input, LINE_MAX) == 0) { + // end code if type in q printf("Exiting.\n"); break; } else { // convert input to an int int inputInt = (uint16_t)atoi(input); - + + // send the command to change the station struct SetStation setStation; setStation.commandType = 1; setStation.stationNumber = htons(inputInt); diff --git a/snowcast_server b/snowcast_server Binary files differindex 1f61e9d..395e06e 100755 --- a/snowcast_server +++ b/snowcast_server diff --git a/snowcast_server.c b/snowcast_server.c index f09bfcc..e8f9525 100644 --- a/snowcast_server.c +++ b/snowcast_server.c @@ -138,6 +138,7 @@ int main(int argc, char *argv[]) get_in_addr((struct sockaddr*)&remoteaddr), remoteIP, INET6_ADDRSTRLEN), newfd); + // send the welcome message to client struct Welcome welcome; welcome.replyType = 2; @@ -160,8 +161,12 @@ int main(int argc, char *argv[]) FD_CLR(i, &master); // remove from master set } else { // we got some data from a client + if (command.commandType == 0) { + // hello message with udpPort + printf("udpPort (from Hello) for new connection is %d.\n", ntohs(command.number)); + } if (command.commandType == 1) { - // update the station for the user + // setStation command for the user printf("TODO: set station to %d\n", ntohs(command.number)); } else { |