序列化是通过套接字发送数据的最佳选择吗? [英] Is Serialization the best for sending data over a socket?

查看:63
本文介绍了序列化是通过套接字发送数据的最佳选择吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人告诉我,序列化不是通过套接字发送东西的最佳方式,但他们说他们在一本书中读过一次,但不确定更好的方式,因为他们以前没有真正做过网络.那么序列化是最好的方法还是有更好的方法.如果这有很大的不同,这也适用于游戏.我通过搜索有关通过它发送对象的问题所看到的似乎大多数人使用序列化,但我只是检查人们在做什么

Someone told me That Serialization was not the best way to send things over a socket but they said they read that in a book once and was not sure of a better way cause they haven't really done networking before. so is Serialization the best way or is there a better way. Also this is for a game if that makes much of a difference. What i see by searching questions about sending objects over it looks like most people use Serialization but im just checking to see what people thing

推荐答案

序列化基本上意味着转换为适合某种存储类型的状态.通过网络发送的数据必须从内存中或从 HD 中取出,并以某种格式进行发送.全部序列化.

To serialize basically means to transform into a state appropriate for some type of storage. Data being sent over the network has to be taken out of memory or off a HD and put in some format for being sent. It is ALL serialized.

人们可能会说,序列化为XML或JSON,这只是序列化的一种非常具体的TYPE.那么是的,您可以根据自己的需要选择更好或更差的.

People may say, serialized to XML or JSON, which is just a very specific TYPE of serialization. Then yes, you can have better or worse ones depending on your needs.

这篇关于序列化是通过套接字发送数据的最佳选择吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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