📄 socketresource.h
字号:
/////////////////////////////////////////////////////////////////////////
// Note: this class is used to manage the connection resource to
// the short message gate, both for server connection resource
// and client connection resource
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
// SocketResource.h: interface for the CSocketResource class.
////Author: lijinhu
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_SOCKETRESOURCE_H__62DDEB1D_8AA1_4D53_8C3E_232A66AF5B4E__INCLUDED_)
#define AFX_SOCKETRESOURCE_H__62DDEB1D_8AA1_4D53_8C3E_232A66AF5B4E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Constants.h"
#include "afxmt.h"
#include "SgipServerSocket.h"
#include "SgipClientSocket.h"
#include "SgipListenSocket.h"
//class CSgipServiceDemoDlg;
typedef struct tagSERVER_CONNECTION
{
int iStatus;//0:free;1:used
int iSocketNo;//
CSgipServerSocket *pServerSocket;
}SERVER_CONNECTION;
typedef struct tagCLIENT_CONNECTION
{
int iSocketNo;//
CSgipClientSocket *pClientSocket;
}CLIENT_CONNECTION;
class CSocketResource
{
//attr
friend class CSgipServerSocket;
friend class CSgipClientSocket;
friend class CSgipListenSocket;
//attr
protected:
// CSgipServiceDemoDlg *m_pMainWnd;
CCriticalSection m_CritSectionClient;
CCriticalSection m_CritSectionServer;
CSgipListenSocket m_ListenSocket;
//CSgipClientSocket m_ClientSocket[CR_MAX_CLIENT_NUM];
CLIENT_CONNECTION m_ClientSocket[CR_MAX_CLIENT_NUM];
SERVER_CONNECTION m_ServerSocket[CR_MAX_SERVER_NUM];
t_INIT_DEF m_ini_def;
BOOL m_bInited;
//function
public:
// void SetMainWnd(CSgipServiceDemoDlg *pMainWnd);
unsigned long SetSgipSerialTime();
int SubmitOneMsg(CString strContent, CString strDestPhoneNum, CString strFeePhoneNo, unsigned long ulSgipSerialNo, int iReportFlag,int iMsgCoding, BOOL bWaitResp = TRUE);
int DeliverOneMsg(CString strUserNum, CString strContent, unsigned long ulSgipSerialNo, int iMsgCoding, BOOL bWaitResp = TRUE);
void Check();
BOOL SetServerSocketStatus(int iSocketNo,int iStatus);
BOOL SetChannelSubmitStatus(unsigned long ulSgipSerial,int iChannelNo,int iSubmitStatus);
BOOL SetChannelStatus(int iSocketNo,int iChannelNo, int iStatus);
BOOL FreeChannel(int iSocketNo,int iChannelNo,unsigned long ulSgipSerialNo);
BOOL InitSocket(t_INIT_DEF ini_def);
BOOL ExitSocket();
BOOL ReInitSocket();
CSocketResource();
virtual ~CSocketResource();
protected:
BOOL InitServerSocket();
BOOL InitClientSocket();
BOOL CloseClientSocket();
BOOL CloseServerSocket();
int GetServerSocket(int *piSocketNo,CSgipServerSocket ** ppServerSocket);
int GetClientSocket(int *piSocketNo , CSgipClientSocket **ppClientSocket , int *piChannelNo ,unsigned long ulSgipSerialNo,int iCmdBufNo);
int ConSocket(int iSocketNo);
// CSgipClientSocket* GetClientSocket(int iSocketNo);
};
#endif // !defined(AFX_SOCKETRESOURCE_H__62DDEB1D_8AA1_4D53_8C3E_232A66AF5B4E__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -