简体   繁体   中英

Sending data over a network connection from c# to unmanaged c++

I have ac# dll that needs to send a quite complex object over the network to an unmanaged c++ process. I'm aware that there are a number of ways to do this but was wondering if anyone can recommend the best fit. Important points to note:

  1. It is critical that the c# process is informed if data is not received by the c++ process. Preferably I'd like as reliable a method of transferring the data as possible.
  2. Unfortunately I'm also under pressure to deliver the packets as quickly as possible so ultimately some trade off will be required between reliability and performance.
  3. The c# object that represents the data is likely to change. This is a third party object which we have no control over. Ideally I'd require some dynamic mechanism in the c++ process to handle these changes with as minimal impact as possible. Worst case scenario would be if we have to recompile the code everytime the object data changes.
  4. Id rather avoid using third party libraries if possible.

Any help would be much appreciated.

As far as I understand about your question, you might mean LAN or WLAN by "network". so, I suggest to use UDP/IP on both sides. and for "It is critical that the c# process is informed if data is not received by the c++ process", you need to handle it manually (eg via an acknowledge packet per receiving a packet or bunch of packets).

there are a lot of samples available over internet for UDP/IP unde 'socket programming': like one here: http://www.abc.se/~m6695/udp.html

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