简体   繁体   中英

persistence or serialization from java to C# Best way to send this object by TCP/IP

what is the best way to serialize an object from Android Java and send to another computer by TCP and then to deserialize in C#?

I originally wanted to use Java serialization, however i hear that i will not be able to deserialize the same file in C# on the other computer.

can i do this with google's gson library? it converts any Java object into JSON string. or is XML better, like using Xstream library an option?

the object is vary simple, it contains only one string and a SQLite Database object and will be sent by TCP/IP sockets from the Android tablet to the desktop computer running windows 7.

i have no experience with C# or .NET, any ideas?

In one of my projects, I have used Google ProtoBuf format for this. http://code.google.com/p/protobuf/

ProtoBuf is a highly compact and efficient format. It supports C# and Java among many others.

Take a look at this article for details: http://www.codeproject.com/Articles/640249/Android-Fast-Communication-with-NET-Using-Protocol

Another option is Apache Thrift.

http://thrift.apache.org/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM