diff --git a/server.c b/server.c index 4b263ef..ee43783 100644 --- a/server.c +++ b/server.c @@ -29,34 +29,15 @@ #include #include -// stuff shared by client and server: #include "common.h" -// Static variables for things you might want to access from several functions: static const char *port = DEFAULT_PORT; // the port to bind to -// Static variables for resources that should be freed before exiting: static struct addrinfo *ai = NULL; // stores address information static int sockfd = -1; // socket file descriptor static int connfd = -1; // connection file descriptor static char* pname; -/* TODO - * You might want to add further static variables here, for instance to save - * the program name (argv[0]) since you should include it in all messages. - * - * You should also have some kind of a list which saves information about your - * ships. For this purpose you might want to define a struct. Bear in mind that - * your server must keep record about which ships have been hit (and also where - * they have been hit) in order to know when a ship was sunk. - * - * You might also find it convenient to add a few functions, for instance: - * - a function which cleans up all resources and exits the program - * - a function which parses the arguments from the command line - * - a function which adds a new ship to your list of ships - * - a function which checks whether a client's shot hit any of your ships - */ - struct Ship { int shipsize; int hitcount;