vc++网络游戏建模与实现-cdrom源码


vc++网络游戏建模与实现-cdrom源码 这本书的源码打包,请慢慢下载
资源截图
代码片段和文件信息
// Protocol.cpp : Defines the entry point for the console application.
//

#include “stdafx.h“
#include “Protocol.h“
#include “conio.h“
#include “ProtocolFunc.h“

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

#define CLIENT_CMDCONTENT “
#define CLIENT_FROM “FromUserId“
#define CLIENT_TO “ToUserId“
#define CLIENT_CONTENT “Content“


int main()
{

CString strBody=“ FromUserId=Webmaster&ToUserId=chicken&Content=HiI need help;“;
CString strCmdContent;
CString strKeyEnd;

ProtocolFunc func;
func.GetProtoLineEnd(CLIENT_CMDCONTENTstrKeyEnd);
func.GetProtoContent(strBodyCLIENT_CMDCONTENTstrKeyEndstrCmdContent);

CPtrList listTemp;
CString strSign=“;“;
func.GetListBySign(strCmdContent&listTempstrSign);

if(listTemp.GetCount()<=0)
{
func.ReleaseList(&listTemp);
return 0;
}
POSITION pos=listTemp.FindIndex(0);
LPNODESTRING pNodeString=(LPNODESTRING)listTemp.GetAt(pos);
if(pNodeString==NULL)
{
func.ReleaseList(&listTemp);
return 0;
}
strCmdContent=pNodeString->strContent;
CPtrList listInfo;
CString strMidSign=“=“;
CString strEndSign=“&“;
func.GetListByTwoSign(strCmdContent&listInfostrMidSignstrEndSign);

CString strFromstrTostrContent;
func.GetValueFromList(CLIENT_FROMstrFrom&listInfo);
func.GetValueFromList(CLIENT_TOstrTo&listInfo);
func.GetValueFromList(CLIENT_CONTENTstrContent&listInfo);

func.DeleteMateList(&listInfo);
func.ReleaseList(&listTemp);

printf(“this is a test of get content from protocol:
“);
printf(“msg from %s to %scontent [%s]
“strFromstrTostrContent);
getch();
return 0;
}




int SendMsg(CString strFromCString strToCString strContent)
{
ProtocolFunc func;
CString strCmdContent;
//增加content
CPtrList MateList;
LPNODEMATE pNodeMate=new NODEMATE;
pNodeMate->strMateName =CLIENT_FROM;
pNodeMate->strMateValue =strFrom;
pNodeMate->strMateName =CLIENT_TO;
pNodeMate->strMateValue =strTo;
pNodeMate->strMateName =CLIENT_CONTENT;
pNodeMate->strMateValue =strContent;
MateList.AddTail(pNodeMate);
func.ReplaceMateList(&MateListstrCmdContent);
func.DeleteMateList(&MateList);
//strCmdContent即为要发送的结构
//send strCmdContent
return 0;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     目录          0  2006-02-17 20:49  chapter10

     目录          0  2006-02-17 20:49  chapter10Protocol

     目录          0  2006-02-17 20:49  chapter10ProtocolDebug

     文件     106543  2006-02-05 16:51  chapter10ProtocolDebugProtocol.exe

     文件      16836  2006-02-05 16:05  chapter10ProtocolProtocol.aps

     文件        245  2006-02-05 16:05  chapter10ProtocolProtocol.clw

     文件       2347  2006-02-05 20:05  chapter10ProtocolProtocol.cpp

     文件       2347  2006-02-05 17:20  chapter10ProtocolProtocol.cpp.bak

     文件       4444  2006-02-05 16:34  chapter10ProtocolProtocol.dsp

     文件        539  2006-02-05 15:45  chapter10ProtocolProtocol.dsw

     文件        332  2006-02-05 15:45  chapter10ProtocolProtocol.h

     文件      58368  2006-02-05 17:21  chapter10ProtocolProtocol.ncb

     文件     212992  2006-02-05 17:21  chapter10ProtocolProtocol.opt

     文件       1457  2006-02-05 15:45  chapter10ProtocolProtocol.rc

     文件       6162  2006-02-05 17:19  chapter10ProtocolProtocolFunc.cpp

     文件       1387  2006-02-05 17:19  chapter10ProtocolProtocolFunc.h

     文件       1619  2006-02-05 15:45  chapter10ProtocolReadMe.txt

     文件        449  2006-02-05 15:45  chapter10ProtocolResource.h

     文件        295  2006-02-05 15:45  chapter10ProtocolStdAfx.cpp

     文件       1085  2006-02-05 15:48  chapter10ProtocolStdAfx.h

     目录          0  2006-02-17 20:49  chapter12

     文件       1686  2006-02-05 20:25  chapter12Card.cpp

     文件       1685  2006-02-05 20:25  chapter12Card.h

    .......      6743  2003-03-26 18:13  chapter12CServerLogic.cpp

    .......      5525  2003-03-20 16:18  chapter12CServerLogic.h

     文件       1622  2006-02-05 20:17  chapter12RecvThreadSocket.h

     文件        531  2001-06-27 11:10  chapter12SendThreadSocket.cpp

     文件        985  2006-02-05 20:20  chapter12SendThreadSocket.h

     文件       1838  2001-06-27 11:10  chapter12Table.cpp

     文件       1883  2006-02-05 20:26  chapter12Table.h

............此处省略261个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)