-
Notifications
You must be signed in to change notification settings - Fork 0
/
cTcpSock.h
executable file
·53 lines (39 loc) · 1018 Bytes
/
cTcpSock.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#pragma once
#include <windows.h>
/** @file
@brief TCPソケット
@author TATSUYA
@date 2007/03/01
*/
class cTcpServerSock;
/** @brief TCPソケットクラス
TCP通信を実装しているクラスです。
*/
class cTcpSock{
public:
// cTcpServerSock から private変数 へのアクセスを可能にする
friend class cTcpServerSock;
cTcpSock();
~cTcpSock();
BOOL IsConnect();
virtual BOOL Connect(LPCSTR, USHORT, HWND, USHORT);
virtual BOOL Disconnect();
virtual BOOL SendData(LPVOID, DWORD);
BOOL SendStr(LPCSTR);
virtual BOOL RecvData(LPVOID, DWORD, DWORD*);
virtual BOOL RecvDataOnce(LPVOID, DWORD, DWORD*);
BOOL SetAsync(HWND, USHORT);
BOOL MatchSock(SOCKET);
LPCSTR GetPeerIpAddress();
USHORT GetPeerPort();
void ErrMsgBox();
protected:
/// 接続フラグ
BOOL m_bIsConnect;
/// ソケットのアドレス情報
SOCKADDR_IN m_Addr;
/// ソケットハンドル
SOCKET m_Socket;
/// エラーメッセージ
char m_szErrMsg[2048];
};