00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
#ifndef _TCPIPCommSend_h
00028
#define _TCPIPCommSend_h
00029
00030
00031
00032
#include <winsock.h>
00033
#include "TraceObject.h"
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00052 class CTCPIPCommSend :
virtual public CTraceObject
00053 {
00054
00055
public:
00056
00062
CTCPIPCommSend(
const long MaxSendBufferLen = 8192 );
00063
00065
virtual ~CTCPIPCommSend();
00066
00067
00068
00069
00070
00071
00077
void Initialize(
const SOCKET Socket );
00078
00079
00086
bool Send(
const void *pData,
00087
const long DataLen );
00088
00094
int GetLastSocketError(
void )
const;
00095
00101
bool Terminating(
void )
const;
00102
00108
void Terminating(
bool Terminating );
00109
00110
00111
00112
00113
protected:
00114
00115
00116
00117
00118
00124
virtual void SendDisInd(
void ) = 0;
00125
00130
void InitializeClass(
const long MaxSendBufferLen );
00131
00132
00133
00134
private:
00135
00136
00137
00138
00144
static void SendThread(
CTCPIPCommSend *pClass );
00145
00146
00147
00148
00149 SOCKET m_Socket;
00150
int m_LastSocketError;
00151
00152 DWORD m_ThreadID;
00153
00154 HANDLE m_hReadPipe;
00155 HANDLE m_hWritePipe;
00156 HANDLE m_ThreadHandle;
00157 HANDLE m_hEventTerminate;
00158 HANDLE m_hEventTerminateFinished;
00159 HANDLE m_hEventStartReceiving;
00160
00161
void *m_pSendBuffer;
00162
long m_MaxSendBufferLen;
00163
00164
bool m_Terminating;
00165
00166
int m_SendCnt;
00167 };
00168
00169
00170
00171
00172
00173
00174
00175 inline int CTCPIPCommSend::GetLastSocketError(
void )
const
00176
{
00177
return m_LastSocketError;
00178 }
00179
00180
00181 inline bool CTCPIPCommSend::Terminating(
void )
const
00182
{
00183
return m_Terminating;
00184 }
00185
00186
00187 inline void CTCPIPCommSend::Terminating(
bool Terminating )
00188 {
00189 m_Terminating = Terminating;
00190 }
00191
00192
00193
00194
#endif // _TCPIPCommSend_h