2014-11-21 12:46:37 +08:00
|
|
|
/*
|
|
|
|
* Client.h
|
|
|
|
*
|
|
|
|
* Created on: 2014-10-18
|
|
|
|
* Author: hanshuo
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CLIENT_H_
|
|
|
|
#define CLIENT_H_
|
|
|
|
|
|
|
|
#include"Socket.h"
|
|
|
|
#include<string>
|
|
|
|
|
|
|
|
class Client
|
|
|
|
{
|
|
|
|
public:
|
2015-01-17 15:52:44 +08:00
|
|
|
Client();
|
|
|
|
Client(std::string _ip, unsigned short _port);
|
|
|
|
Client(unsigned short _port);
|
|
|
|
~Client();
|
|
|
|
|
2014-11-21 12:46:37 +08:00
|
|
|
bool connectServer();
|
|
|
|
bool disconnectServer();
|
|
|
|
bool send(const std::string& _msg);
|
|
|
|
bool receiveResponse(std::string& _recv_msg);
|
|
|
|
|
|
|
|
void run();
|
|
|
|
private:
|
|
|
|
std::string ip;
|
|
|
|
unsigned short port;
|
|
|
|
std::string password;
|
|
|
|
Socket socket;
|
|
|
|
int random_key;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* CLIENT_H_ */
|