通过内存流和二进制格式化程序读取网络流 [英] Reading network streams via memory stream and binary formatter

查看:101
本文介绍了通过内存流和二进制格式化程序读取网络流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

晚上好

我正在为我的应用程序创建一个小的登录服务器,它是一个TCP连接.如果您熟悉"UE4",则它是连接到登录服务器并发送用户凭据的虚幻四引擎应用程序,然后在 数据库服务器.

I'm creating a little login server for my application and it is a TCP connection. If you are familiar with "UE4", it is a Unreal Four Engine application that connects to the login server and sends the user credentials, that is then checked on a database server.

我来自游戏编程背景,而不是网络背景.让我感到困惑的一件事是,人们正在使用内存流和二进制格式化程序来读取数据,并通过套接字发送数据.

由于该流是网络的后备存储,为什么不使用装饰器流(该网络流来读取和写入字节)?

I come from a games programming background, and not a networking background. One thing that confuses me is that people are using a memory stream and binary formatter to read the data, and send the data across the socket.

Since the stream is a backing store of network, why not use the decorator stream, the network stream to read and write bytes?

C#应用程序服务器如何知道什么?被打包发送?例如,数据包的类型.客户端可以将其x和y位置发送到服务器,然后向他们的朋友发送一条消息.服务器如何知道这种类型的数据包 不是矢量包等.

How does the C# application server know what is  being sent in a packet? For example, the type of packet. The client may send their x and y positions to the server, and next a message to their friends. How does the server know that this type of packet is not a vector packet etc.

抱歉,如果不清楚,我不是最好的解释自己的人.

Sorry if this is not clear, I am not the best to explain my self.

推荐答案

您好,Moynzy,

Hi Moynzy,

根据您的描述,您的案件与  network更相关,我会将您的案件移至WCf论坛以获得更好的支持.

Based on your description, your case more related to  network , I will move your case to WCf forum for better support.

最诚挚的问候,

克里斯汀


这篇关于通过内存流和二进制格式化程序读取网络流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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