Communication.h
上传用户:hysujiao87
上传日期:2007-12-02
资源大小:156k
文件大小:1k
- #pragma once
- class CXMLParser;
- class CCommunication
- {
- protected:
- CSocket _sock;
- sockaddr_in _addrServer;
- BOOL _created;
- BOOL _connected;
- public:
- CCommunication(void);
- ~CCommunication(void);
- HRESULT init(LPCTSTR serverIP, short port = 6000);
- HRESULT create(void);
- HRESULT connect(LPCTSTR serverIP, short port = 6000);
- HRESULT receiveResponse(CXMLParser &parser, DWORD timeOut=5000, BOOL popupMessage=TRUE);
- HRESULT sendLogonRequest(LPCTSTR userID, LPCTSTR password);
- HRESULT sendRegisterRequest(LPCTSTR userID, LPCTSTR password, LPCTSTR nickname);
- HRESULT sendAddFriendRequest(LPCTSTR userID, LPCTSTR friendID);
- HRESULT sendDownloadFriendsRequest(LPCTSTR userID);
- HRESULT sendQueryUserRequest(LPCTSTR userID);
- HRESULT sendOnlineRequest(CString userID, u_short port);
- HRESULT sendLogoffRequest(LPCTSTR userID);
- };