ffead.server.doc
Client.h
1 /*
2  Copyright 2010, Sumeet Chhetri
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 /*
17  * Client.h
18  *
19  * Created on: Mar 27, 2010
20  * Author: sumeet
21  */
22 
23 #ifndef CLIENT_H_
24 #define CLIENT_H_
25 #include "ClientInterface.h"
26 using namespace std;
27 class Client : public ClientInterface {
28  bool connected;
29  int sockfd;
30  Logger logger;
31 public:
32  Client();
33  virtual ~Client();
34  bool connection(string,int);
35  bool connectionUnresolv(string host,int port);
36  int sendData(string);
37  string getTextData(string hdrdelm,string cntlnhdr);
38  string getBinaryData(int,bool);
39  void closeConnection();
40  bool isConnected();
41  void setSocketBlocking();
42  void setSocketNonBlocking();
43  int receive(string& buf,int flag);
44  int receivelen(string& buf,int len,int flag);
45  string getData();
46  int sendlen(string buf,int len);
47 };
48 
49 #endif /* CLIENT_H_ */