QQSocket.h
上传用户:hysujiao87
上传日期:2007-12-02
资源大小:156k
文件大小:1k
- #pragma once
- /////////////////////////////////////////////////////////////////////////////
- // CQQSocket command target
- class CQQSocket : public CSocket
- {
- // Attributes
- public:
- CByteArray _receivedIn;
- sockaddr_in _addrFrom;
- // Operations
- public:
- CQQSocket();
- BOOL create(short port);
- static HRESULT stringToIPAddr(LPCTSTR serverAddr, sockaddr_in &addr);
- static CString IPAddrToString(const sockaddr_in &addr);
- HRESULT sendToHost(SOCKADDR *addrHost, BYTE *buffer, INT_PTR bufferSize);
- BOOL receive(void);
- int sendBack(BYTE *data, int dataLength){
- return SendTo(data, dataLength, (SOCKADDR*)&_addrFrom, sizeof(sockaddr_in));
- }
- // Overrides
- public:
- virtual ~CQQSocket();
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CQQSocket)
- public:
- //}}AFX_VIRTUAL
- // Generated message map functions
- //{{AFX_MSG(CQQSocket)
- // NOTE - the ClassWizard will add and remove member functions here.
- //}}AFX_MSG
- // Implementation
- protected:
- };
- /////////////////////////////////////////////////////////////////////////////
- //{{AFX_INSERT_LOCATION}}
- // Microsoft Visual C++ will insert additional declarations immediately before the previous line.