Writing and reading C# class data or structures to/from C app

Writing and reading C# class data or structures to/from C app

Here is my situation...

I need to connect to a piece of test equipment (the server) that will pass formatted data structures in near real time across a socket on a specific port. The software was written in C++ on a Windows XP OS. I can not make changes to that software.

I am currently learning .NET C# programming (VS2010). This is not a great challenge, as I have many years experience in C/C++.

There are several formatted setup messages I must send to the server before it will start passing data. I have created classes for all messages from the C structs provided in the server ICD.

My problem is not being able to pass a struct directly to the server. I have been googling my fingers to the bones trying to find the best way to transfer the messages in a way that it will be understood by the server. Serialization and/or Marshalling seem to be the best options, but will the server be able to decode it? If it does, how will the data be returned?

I don't have access to the server (yet), so I have to trust that the coding will just work when I do get to 'play' with it.

I would appreciate any comments.

Thanks

Add Comment

Put code snippets inside language tags:
[language] [/language]

Examples:
[javascript] [/javascript]
[actionscript] [/actionscript]
[csharp] [/csharp]

See here for supported languages.

Javascript must be enabled to submit anonymous comments - or you can login.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.