Search code examples
c#socketsserializationtcpnetwork-programming

Is Serialization the best for sending data over a socket?


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


Solution

  • 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.

    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.