如何在C#中创建数据包 [英] How to create a packet in C#

查看:195
本文介绍了如何在C#中创建数据包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直想知道游戏如何生成这样的数据包:

I always wondered how could a game generate a packet like this:

22 00 11 00 6D 79 75 73 65 72 6E 61 6D 65 00 00 00 00 00 00 6D 79 70 61 73 73 77 6F 72 64 00 00 00 00 00 00

LENGTH-HEADER-USERNAME-PASSWORD

在游戏代码中,它们的功能是什么?如何编写类似的内容?仅仅是Encoding.ASCII.GetBytes("Some String Values")吗?尽管我怀疑它是那样写的.

In the game code what should be their function or how do they write something like that? Is it simply Encoding.ASCII.GetBytes("Some String Values")? Although I doubt it is written that way.

每次我尝试向某人询问时,他都认为我要分析数据包.我不知道-我想知道要使用C#创建像上面的数据包那样需要做些什么.

Every time I try to ask someone that, he thinks that I want to analyze packet. I don't - I want to know what I need to do in order to create a packet like the one above, in C#.

推荐答案

当然,使用字符串生成器与数据包结构非常相距甚远,您必须使用byte []并按索引向其附加值.

Of course using a string builder is very far from packet structuring, you must use byte[] and append values to it by index.

这篇关于如何在C#中创建数据包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆