Java - .Net object interchange, not web-based

前端 未结 3 1780
醉话见心
醉话见心 2021-01-25 06:32

I have a client-server system implemented in C#, and the client and server exchange .Net objects via serialization / deserialization and communicating via TCP/IP. This runs on a

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-25 07:07

    I would suggest either JSON or XML (which is based on a .xsd file) because these are independent of their respective implementations (instead of something like an ObjectOutputStream in java).

    The problem of having this format between the two components (client and server) is that they need to be at the same version. My best practice is to have one underlying definition of the format (i use xml with an xsd file which specifies how the xml has to look like), then use jaxb to generated java classes. That way you can (un)marshal from/to xml in the java part.

    I am very sure a similar thing exists in the world of .NET.

    JSON is smaller than xml in size, i find xml to be more readable.

提交回复
热议问题