⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rainsock.h

📁 好用的键盘超人源代码
💻 H
字号:
#if !defined(AFX_RAINSOCK_H__63A35EA3_57EB_11D4_91C4_000000000007__INCLUDED_)
#define AFX_RAINSOCK_H__63A35EA3_57EB_11D4_91C4_000000000007__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// RainSock.h : header file
//

#include "afxsock.h"
#include "raincom.h"

/////////////////////////////////////////////////////////////////////////////
// CRainSock command target

class CRainSock : public CAsyncSocket
{
// Attributes
private:
	int connectState;
public:
	int isSockCreated;
// Operations 
public:
	CRainSock();
	virtual ~CRainSock();

	void setConnectState(int state);
	int getConnectState();
// Overrides
public:
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CRainSock)
	//}}AFX_VIRTUAL
  

	// Generated message map functions
	//{{AFX_MSG(CRainSock)
		// NOTE - the ClassWizard will add and remove member functions here.
	//}}AFX_MSG

// Implementation
protected:
};

/////////////////////////////////////////////////////////////////////////////
// CRainSSSock command target

class CRainSSSock : public CRainSock
{
// Attributes
public:
	CString usrIP;
	CString usrName;

	int usrID;


	struct hitStrList
	{
       ULONG hitStrSeq;     //hit sequence of string
	   ULONG hitTickTimer;  //hit tick timer of string
	   int   hitStrLen ;    //for rain result     
	   int   state;
	}hitStrList[RAIN_Y];

	int rightChar;   
	int rightStr;  
       
// Operations
public:
	CRainSSSock();
	virtual ~CRainSSSock();
    
    void init();
	void insertUsrHit(ULONG hitStrSeq,ULONG hitTickTimer,int hitStrLen);

// Overrides
public:

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CRainServer)
	 public:
	 virtual void OnReceive(int nErrorCode);
	//}}AFX_VIRTUAL
    
	// Generated message map functions
	//{{AFX_MSG(CRainServer)
		// NOTE - the ClassWizard will add and remove member functions here.
	//}}AFX_MSG

// Implementation
protected:
};

/////////////////////////////////////////////////////////////////////////////
// CRainMSSock command target

class CRainMSSock : public CRainSock
{
// Attributes
public:
	CString myIP;
	CRainSSSock slaveSocket[DFT_CLIENT_NUM];

	int usrID;

	struct hitStrList
	{
       ULONG hitStrSeq;    //hit sequence of string
	   ULONG hitTickTimer; //hit tick timer of string
	   int   hitStrLen;    //for rain result
	   int   state;
	}hitStrList[RAIN_Y];

	int   rightChar;    
	int   rightStr;  
    

// Operations
public:
	CRainMSSock();
	virtual ~CRainMSSock();

	void init();
	int  findFreeSlave();
	void checkSlave();
    void req(); 
	void begin(int stepTime);
	void end();
	void dispatchStr(char *str ,int len,int whereX,ULONG seq);
	int  checkUsrHit(ULONG hitStrSeq,ULONG hitTickTimer);
	void insertUsrHit(ULONG hitStrSeq,ULONG hitTickTimer,int hitStrLen);
	void initUsrHit();
    
// Overrides
public:

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CRainServer)
	public:
	virtual void OnAccept(int nErrorCode);
	//}}AFX_VIRTUAL

	// Generated message map functions
	//{{AFX_MSG(CRainServer)
		// NOTE - the ClassWizard will add and remove member functions here.
	//}}AFX_MSG

// Implementation
protected:
};

/////////////////////////////////////////////////////////////////////////////
// CRainCSOCK command target

class CRainCSock : public CRainSock
{
// Attributes
public:
    CString serverIP;
	CString myIP;

	int usrID;
    
	// these user information list,maybe change to struct
    CString usrName[DFT_CLIENT_NUM+1];
	CString usrIP[DFT_CLIENT_NUM+1];
	int     rightChar[DFT_CLIENT_NUM+1];    
	int     rightStr[DFT_CLIENT_NUM+1];   
	int     allUsrID[DFT_CLIENT_NUM+1];
    int     usrNumber; 
	int     totalStr;  
	ULONG   totalTime;   
    
// Operations
public:
	CRainCSock();
	virtual ~CRainCSock();

    virtual  BOOL Connect( LPCTSTR lpszHostAddress, UINT nHostPort );  
    void init();

	void hit(ULONG hitStrSeq,ULONG hitTickTimer,int hitStrLen);
   
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CRainClient)
	public:
    virtual void OnConnect(int nErrorCode);
	virtual void OnReceive(int nErrorCode);

	//}}AFX_VIRTUAL

	// Generated message map functions
	//{{AFX_MSG(CRainClient)
		// NOTE - the ClassWizard will add and remove member functions here.
	//}}AFX_MSG

// Implementation
protected:
};
/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_RAINSOCK_H__63A35EA3_57EB_11D4_91C4_000000000007__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -