Remove comments left by OSUE-Team
This commit is contained in:
parent
6065b90eb2
commit
6f47f3c652
19
server.c
19
server.c
@ -29,34 +29,15 @@
|
|||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
// stuff shared by client and server:
|
|
||||||
#include "common.h"
|
#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 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 struct addrinfo *ai = NULL; // stores address information
|
||||||
static int sockfd = -1; // socket file descriptor
|
static int sockfd = -1; // socket file descriptor
|
||||||
static int connfd = -1; // connection file descriptor
|
static int connfd = -1; // connection file descriptor
|
||||||
static char* pname;
|
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 {
|
struct Ship {
|
||||||
int shipsize;
|
int shipsize;
|
||||||
int hitcount;
|
int hitcount;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user