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

📄 smg.cpp

📁 移动短信api
💻 CPP
字号:
// smg.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "smg.h"

//import cmppapi
#include "md5.h"
#include "cmpp.h"

#pragma comment(lib, "cmppapi.lib")

#define CMPP_IMPORT


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// The one and only application object

CWinApp theApp;

using namespace std;

//
//
//
void OnSpMsg(CMPP_SPTOSMG css)
{
	printf("**smg msg,len = %d, cmd = 0x%08x, seq = %d**\n", \
		css.pk_head.nTotalLength, css.pk_head.nCommandId, css.pk_head.nSeqId);

	return;
}

void OutProgramInfo()
{
	printf("\n*****************************************************************************\n");
	printf("**软件名称 - <<中国移动通信CMPP3.0短消息网关开发接口库>> V1.0 服务端例程.\n");
	printf("**作者主页 - http://princetoad.xiloo.com\n");
	printf("**联系方式 - Email:princetoad@126.com\n");
	printf("**授权方式 - Used Free,SourceCode On Sale.\n");
	printf("**********************Published By PrinceToad Nov.22.03.*********************\n\n");
}

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
	int nRetCode = 0;

	//1.声明一个CCmppServer对象.
	CCmppServer	cmppserv;

	// initialize MFC and print and error on failure
	if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
	{
		// TODO: change error code to suit your needs
		cerr << _T("Fatal Error: MFC initialization failed") << endl;
		nRetCode = 1;
	}
	else
	{
		// TODO: code your application's behavior here.
		OutProgramInfo();
		
		//2.启动CCmppServer,默认绑定本地地址,默认端口.
		//启动后所有模块在后台运行.
		nRetCode = cmppserv.Start(OnSpMsg);
		if (0 != nRetCode) {
			printf("CmppServer Start Failed With Error: %d.\n", nRetCode);
			return nRetCode;
		}

		system("pause");
		//3.中止服务器运行.
		cmppserv.Release();
	}

	return nRetCode;
}


⌨️ 快捷键说明

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