www.pudn.com > QQ2004_Source_0.01.rar > Communication.h


#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); 
};