/* Global constants - can be used by children classes as return values, and by any clients to check what type the socket is of */
constintSOCK_CLIENT='C';
constintSOCK_SERVER='S';
/* Abstract class for a Socket. 'Client' and 'Server' derive from
thisclass,andextendthefunctionsdefinedhere.*/
classSock{
classSock{
/* Define a parent class of client and server, that can be used in main.cpp, instead of defining a client and server. This will allow me to create a struct for Mode, that can store either a client or a server, depending on what mode the game is in. */
protected:
protected:
intip_ver;
intip_ver;
charprotocol;
charprotocol;
@ -13,8 +18,10 @@ protected:
intsock_fd;
intsock_fd;
std::stringaddress;
std::stringaddress;
structsockaddr*dest;
structsockaddr*dest;
socklen_taddrlen;
intother_socket;// The peer socket (the client if this socket is a server, and the server if this socket is a client) */