CSIS 440 chat client/server project.

User.h 1.2KB

    #ifndef __SIRC_USER__ #define __SIRC_USER__ /* Author: Matt Kava Asmt: CSIS 440, Spring 2010, Assignment 6 :: IRC-Like Client/Server Description: Sirc User class header file */ #include <string> class User { /** Private Members **/ std::string _nick; int _sockfd; std::string _ip; std::string _port; bool _validated; /** Private Methods **/ public: /** Public Members **/ std::string Nick(); void Nick(std::string); std::string IP(); void IP(std::string); std::string Port(); void Port(std::string); int SockFD(); void SockFD(int); bool Validated(); void Validated(bool); /** Public Methods **/ // User() :: Creates a default User object with empty instantiation. User(); // User(std::string nick, int sockfd); virtual ~User(); // checks the condition of the socket, and closes it, if necessary void CloseSocket(); // Server only :: Sends a message to the user void Send(std::string); // Server only :: Gets a message from the user std::string Recv(); /* Loads the IP and Port values from the encapsulated socket file descriptor (_sockfd). In particular, it gets the IP and Port of the far host and not the local machine. This should only be used for a server. It's not as useful for a client. */ bool LoadIpPort(); }; #endif