4

I have python server that serialize some dictionary by using the marshal module. And send serialized message to the c# client socket. How I can deserialize this message on the client (c#) side. I can not use IronPython because of problems with the speed of execution.

Or do you know other ways to serialize/deserialize "messages" between Python and c#.

3
  • You should be using WCF for interoperability. Commented Dec 6, 2012 at 22:50
  • What speed of execution problems? Commented Dec 6, 2012 at 22:52
  • @IgnacioVazquez-Abrams This program should be executed in 3 seconds. And IronPython module execution add 1-3 extra seconds. Commented Dec 7, 2012 at 8:21

4 Answers 4

3

What about JSON? You could write, or maybe even find, a de-Python-pickle-er for C#, but something like a dict is easy to represent in JSON, and that's a well known, well defined standard for which reliable, fast serilaize/deserialize libraries exist in nearly every language. There's also XML of course, but JSON's usually easier to work with.

Sign up to request clarification or add additional context in comments.

Comments

1

marshal is generally Python-specific. If you want cross-language support then you should use json instead.

Comments

1

YAML support is available in many languages and supports many data types JSON syntax is a subset of YAML version 1.2 and also enjoys wide-spread support.

Comments

0

As an alternative to marshal, "protocol buffers" has good support in both python and c#. Google provide the python implementation, and there are multiple c# implementations. Protocol buffers offers excellent versioning support, a rich variety of cross platform implementations, and very efficient serialization, ideal for fast binary socket usage.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.