通过套接字进行字节序转换 [英] Endian conversions through sockets

查看:88
本文介绍了通过套接字进行字节序转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想知道是否需要对通过C#中的套接字发送的数据进行字节序转换,还是底层的调用会为您转换它?

我正在阅读网络字节顺序,我在想这是否会影响不同类型的数据,例如String,Short和Longs等.

Hi,

I was wondering if there is a need to do endian conversions for data being send via sockets in C# or will the underlying calls convert it for you?

I was reading up on network byte order I was thinking if this would affect different kinds of data like String, Short and Longs, etc...

Thanks!

推荐答案

如果连接的两端都是.net应用程序,则无需进行转换,但是如果标准要求特定的数据包格式和结构,则您将必须相应地创建字节序.
If both sides of the connection is a .net application then there is no need for conversions, but if the standard requires a specific packet format and structure then you will have to create the endian accordingly.


这篇关于通过套接字进行字节序转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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