diff options
-rw-r--r-- | client.c | 34 | ||||
-rw-r--r-- | server.c | 4 |
2 files changed, 3 insertions, 35 deletions
@@ -31,7 +31,7 @@ void *get_in_addr(struct sockaddr *sa) int main(int argc, char *argv[]) { int sockfd, numbytesrecv, numbytessent, recvbytes; - char buf[MAXDATASIZE]; + // char buf[MAXDATASIZE]; struct addrinfo hints, *servinfo, *p; int rv; char s[INET6_ADDRSTRLEN]; @@ -88,22 +88,8 @@ int main(int argc, char *argv[]) exit(1); } msg.numStations = ntohs(msg.numStations); - // print the num bytes received - // printf("client: received '%s'\n", msg); - // printf("size of '%d'\n", recvbytes); printf("Welcome to Snowcast! The server has %d stations.\n", msg.numStations); - // printf("type %d", msg.replyType); - // close(sockfd); - - // if ((numbytesrecv = recv(sockfd, buf, MAXDATASIZE-1, 0)) == -1) { - // perror("recv"); - // exit(1); - // } - // buf[numbytesrecv] = '\0'; - - // printf("client: received '%s'\n",buf); - - // make a struct for the message, number is thennubmer of stations + struct Hello hello; hello.commandType = 0; // convert updPort to an int @@ -114,22 +100,6 @@ int main(int argc, char *argv[]) perror("send"); exit(1); } - - // make new struct for the incoming message - // buf[numbytesrecv] = '\0'; - // char bufff[MAXDATASIZE]; - // if ((recvbytes = recv(sockfd, bufff, MAXDATASIZE, 0)) == -1) - // { - // perror("recv"); - // exit(1); - // } - // bufff[recvbytes] = '\0'; - - // // print the num bytes received - // printf("client: received '%d'\n", recvbytes); - - // //printf("Welcome to Snowcast! The server has %d stations.\n", ntohl(msg.number)); - // printf("%s", bufff); close(sockfd); return 0; @@ -139,11 +139,9 @@ int main(int argc, char *argv[]) struct Welcome welcome; welcome.replyType = 2; welcome.numStations = htons(argc - 2); - if ((b = send(new_fd, &welcome, sizeof(struct Welcome), 0)) == -1) + if ((send(new_fd, &welcome, sizeof(struct Welcome), 0)) == -1) perror("send"); close(new_fd); - // print the num bytes sent - // printf("server: sent '%d'\n",b); exit(0); } // close(new_fd); // parent doesn't need this |