RecvThreadSocket.h
资源名称:1731.rar [点击查看]
上传用户:swkcbjrc
上传日期:2016-04-02
资源大小:45277k
文件大小:2k
源码类别:
游戏
开发平台:
Visual C++
- // RecvThreadSocket.h: interface for the CRecvThreadSocket class.
- //功能描述:该类是接收线程类
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_RECVTHREADSOCKET_H__9BEFC630_2EBA_408C_99EE_F4530B93CD77__INCLUDED_)
- #define AFX_RECVTHREADSOCKET_H__9BEFC630_2EBA_408C_99EE_F4530B93CD77__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #include "SocketModel.h"
- enum
- {
- ENUM_DEFAULT,
- ENUM_RECVSUCCESS,
- ENUM_DELETEUSER,
- ENUM_GOONRECV,
- ENUM_HEADERSUCCESS
- };
- #define MAXBUF 3000
- class CRecvThreadSocket : public CDPSocketModel
- {
- public:
- CRecvThreadSocket();
- virtual ~CRecvThreadSocket();
- public:
- //##ModelId=3B394E060177
- void ReadContent(CString& strContent);
- //##ModelId=3B394E060181
- int GetReadBufCount(void);
- //##ModelId=3B394E060195
- BYTE ReadAllData(int& nRecvCount);
- //##ModelId=3B394E06019F
- inline void SetRecvSocket(SOCKET hRecv)
- {ASSERT(hRecv!=INVALID_SOCKET);m_hRecv=hRecv;};
- //##ModelId=3B394E0601B3
- inline SOCKET GetRecvSocket(void)
- {return(m_hRecv);};
- private:
- //##ModelId=3B394E0601BE
- void FreeBuffer(void);
- //##ModelId=3B394E0601D2
- BYTE GetPacketCount(int& nPacketCount);
- //##ModelId=3B394E0601E5
- int GetHeaderLength(void);
- private:
- //##ModelId=3B394E0601F9
- CString m_strReadBuf;//接受缓冲区
- //##ModelId=3B394E060218
- SOCKET m_hRecv;//接受端口
- //##ModelId=3B394E06023F
- CHAR m_chBuffer[MAXBUF];//数据缓冲区
- //##ModelId=3B394E06025D
- BYTE m_byFlag;//标志
- };
- #endif // !defined(AFX_RECVTHREADSOCKET_H__9BEFC630_2EBA_408C_99EE_F4530B93CD77__INCLUDED_)