-
大小: 44.42MB文件類型: .rar金幣: 1下載: 0 次發(fā)布日期: 2023-08-04
- 語言: C/C++
- 標(biāo)簽: vc??rpg??網(wǎng)絡(luò)游戲??源碼??
資源簡介
vc++網(wǎng)絡(luò)游戲建模與實(shí)現(xiàn)-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:\r\n“);
printf(“msg?from?%s?to?%scontent?[%s]\r\n“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即為要發(fā)送的結(jié)構(gòu)
//send?strCmdContent
return?0;
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄??????????0??2006-02-17?20:49??chapter10
?????目錄??????????0??2006-02-17?20:49??chapter10\Protocol
?????目錄??????????0??2006-02-17?20:49??chapter10\Protocol\Debug
?????文件?????106543??2006-02-05?16:51??chapter10\Protocol\Debug\Protocol.exe
?????文件??????16836??2006-02-05?16:05??chapter10\Protocol\Protocol.aps
?????文件????????245??2006-02-05?16:05??chapter10\Protocol\Protocol.clw
?????文件???????2347??2006-02-05?20:05??chapter10\Protocol\Protocol.cpp
?????文件???????2347??2006-02-05?17:20??chapter10\Protocol\Protocol.cpp.bak
?????文件???????4444??2006-02-05?16:34??chapter10\Protocol\Protocol.dsp
?????文件????????539??2006-02-05?15:45??chapter10\Protocol\Protocol.dsw
?????文件????????332??2006-02-05?15:45??chapter10\Protocol\Protocol.h
?????文件??????58368??2006-02-05?17:21??chapter10\Protocol\Protocol.ncb
?????文件?????212992??2006-02-05?17:21??chapter10\Protocol\Protocol.opt
?????文件???????1457??2006-02-05?15:45??chapter10\Protocol\Protocol.rc
?????文件???????6162??2006-02-05?17:19??chapter10\Protocol\ProtocolFunc.cpp
?????文件???????1387??2006-02-05?17:19??chapter10\Protocol\ProtocolFunc.h
?????文件???????1619??2006-02-05?15:45??chapter10\Protocol\ReadMe.txt
?????文件????????449??2006-02-05?15:45??chapter10\Protocol\Resource.h
?????文件????????295??2006-02-05?15:45??chapter10\Protocol\StdAfx.cpp
?????文件???????1085??2006-02-05?15:48??chapter10\Protocol\StdAfx.h
?????目錄??????????0??2006-02-17?20:49??chapter12
?????文件???????1686??2006-02-05?20:25??chapter12\Card.cpp
?????文件???????1685??2006-02-05?20:25??chapter12\Card.h
????.......??????6743??2003-03-26?18:13??chapter12\CServerLogic.cpp
????.......??????5525??2003-03-20?16:18??chapter12\CServerLogic.h
?????文件???????1622??2006-02-05?20:17??chapter12\RecvThreadSocket.h
?????文件????????531??2001-06-27?11:10??chapter12\SendThreadSocket.cpp
?????文件????????985??2006-02-05?20:20??chapter12\SendThreadSocket.h
?????文件???????1838??2001-06-27?11:10??chapter12\Table.cpp
?????文件???????1883??2006-02-05?20:26??chapter12\Table.h
............此處省略261個(gè)文件信息
評論
共有 條評論