Search code examples
cflashserializationrmicorba

communication between 2 programs written in different language - Serialization?


when is serialization,marshaling etc required during communication between programs residing across 2 different machines /network/Internet?

Suppose I have a client program in java/flash and a server program in C. Can't I implement communication using a custom protocol of my own ? I guess so. When is serialization etc needed?I am aware Java RMI,CORBA etc have these mechanisms. But why? Is it a must? please enlighten me?


Solution

  • Can't I implement communication using a custom protocol of my own ? I guess so.

    You can. You probably shouldn't reinvent the wheel. Serialization is tricky. Use a well tested, standard solution for better results. You'll spend far less time learning an API than writing data passing routines.

    When is serialization etc needed?

    For starters, it's needed to take some in memory structure from one process to another.

    There are more use cases described here: http://en.wikipedia.org/wiki/Serialization

    I am aware Java RMI,CORBA etc have these mechanisms. But why? Is it a must? please enlighten me?

    None of these "are a must", like you said, you could write your own protocol. You're far better of (IMO) leaning on some existing technologies in this area, like XML or one of the others you mention. Which technology you use is really dependent on what you're trying to do, so I'm not going to speculate :)

    One great mechanism for passing serialized data is Google's protocol buffers. They take care of the encoding (in a much more efficient way than XML) and endian translation.