blob: c585e98b3d3cc22cc7664c32540b0f3cb0f21eba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#if !defined(WASOCKETCONNECTION_H)
#define WASOCKETCONNECTION_H
#include "common.h"
#include "WhatsAPI++/ISocketConnection.h"
#include <iostream>
#include "WhatsAPI++/WAException.h"
#include "WhatsAPI++/WALogin.h"
#include <windows.h>
class WASocketConnection : public ISocketConnection
{
public:
static HANDLE hNetlibUser;
private:
int readSize;
int maxBufRead;
bool connected;
HANDLE hConn;
public:
WASocketConnection(const std::string& dir, int port) throw (WAException);
virtual ~WASocketConnection();
void write(int i);
unsigned char read();
int read(std::vector<unsigned char>& b, int off, int length);
int read(unsigned char*, int length);
void flush();
void write(const std::vector<unsigned char>& b, int length);
void write(const std::vector<unsigned char>& bytes, int offset, int length);
void makeNonBlock();
int waitForRead();
void forceShutdown();
void dump(const void *buf, int length);
static void initNetwork(HANDLE hNetlibUser) throw (WAException);
static void quitNetwork();
};
#endif // WASOCKETCONNECTION_H
|