Lianzhong Upgrade Protocol Analysis 2

xiaoxiao2021-03-06  44

Zuan Lianzhong Upgrade Agreement Analysis Continued Articles (1)

Cloud Network (Jimzj@21cn.com)

Because the last time is doing a project, there is not much time, there is no more time to write the entire process of the joint agreement analysis of the joint agreement, and all the contents of all agreements have passed the "external mutage joint" upgrade agreement Analysis (also available in the 9CBS Development Master "online game protocol analysis" to find related content), after the online publication, receive a lot of readers' letter, I hope I will complete the entire process of the association analysis, and Try the key protocol analysis; just now there is not much work in hand (don't tell my boss, or if he can't put all the tasks, I will put all the tasks. "You can complete the analysis of this agreement.

The last article has explained how the data is received, and it will not be repeated here. If you don't understand, you can find this article to read it. Now I am from the contents of the protocol, and how to get the data from the program to indicate every command, I hope everyone can do it with this article.

Before analyzing the command, it is still necessary to explain how to extract a description of the package we want from the received network data (below below to find a complete protocol package from the network data)

INT __fastcall tcltsocket :: AnalylinkRecvpack (int Nlen, Pchar PDataBuff, Int & Nlastlen, Int Nsrcport)

{

Int ncposition = -1; // The start position of the header

INT ncmdflag = -1; // command word logo

LPPACKHEAD PPACKHEAD; / / Baotou Structure

INT nappckheadsize = sizeof (packhead); / / Baotou length

IF (nLastlen

// Find the header start

For (int i = 0; i

{

ncmdflag = * (int *) (PDATABUFF I); // One byte Search Network Packet Command Word Sign

IF (m_gamecmdflagmap.find (ncmdflag)! = m_gamecmdflagmap.end ())

{

ncposition = i; // Looking for the start position of the desired command

Break;

}

}

..........................

IF (PPACKHEAD-> NDATALEN> (NLastlen - NAPPPACKHEADSIZE)) // Analysis is completed

{

Memcpy (PDATABUFF, PDATABUFF NCPSITION), NLASTLEN;

Return 1;

}

Else // here's PPACKHEAD-> NDATALEN is the length of the package I said.

{

IF (NLastlen - PPackhead-> NDATALEN - NAPPPPACKHEADSIZE))

{

NLASTLEN = 0;

}

Else

{

NLASTLEN = NLASTLEN - PPACKHEAD-> NDATALEN - NAPPPACKHEADSIZE

}

Try

{

DispatchPackets (Pchar) PPACKHEAD, NSRCPORT); // Get a complete protocol package here}

Catch (Exception & E)

{

}

Memcpy (PDATABUFF, PDATABUFF NCPSITION PPACKHEAD-> NDATALEN NAPPPACKHEADSIZE, NLASTLEN); / / The currently left network data, after the next reception of other data

Return 0;

}

}

.....to be continued

转载请注明原文地址:https://www.9cbs.com/read-66912.html

New Post(0)