-
Notifications
You must be signed in to change notification settings - Fork 0
/
Agentsock.h
38 lines (25 loc) · 984 Bytes
/
Agentsock.h
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
#ifndef __AGENTSOCK_H__
#define __AGENTSOCK_H__
class CAgentSocket : public CAsyncSocket {
DECLARE_DYNAMIC(CAgentSocket);
public:
CAgentSocket();
// functions from CAsyncsocket adapted for this use
BOOL Create(UINT nSocketPort, LPCTSTR lpszSocketAddress);
BOOL Bind(UINT nSocketPort, LPCTSTR lpszSocketAddress);
BOOL Connect(LPCTSTR lpszHostAddress, UINT nHostPort);
int ReceiveFrom(void *lpBuf, int nBufLen, CString &rSocketAddress, UINT &rSocketPort, int nFlags);
int SendTo(const void *lpBuf, int nBufLen, UINT nHostPort, LPCTSTR lpszHostAddress, int nFlags);
// get and set functions
void SetPort(UINT port) { m_uiPort = port; };
UINT GetPort(void) { return m_uiPort; };
CString GetAddress(void) { return m_sSocketAddress; };
protected:
// notification functions
virtual void OnReceive(int nErrorCode);
private:
SOCKADDR_IN sockAddr;
UINT m_uiPort;
CString m_sSocketAddress;
};
#endif // __AGENTSOCK_H__