在CSocket exe通信中传递CObArray或CObject [英] Passing CObArray or CObject in CSocket exe communication

查看:98
本文介绍了在CSocket exe通信中传递CObArray或CObject的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我找到了使用CSocket类在mfc中通信两个exe的方法.
文章
A-Universal-TCP-Socket-Class-for- Non-blocking-Serv [

Hi ALL,
I found way to communicate two exe in mfc by using CSocket class.
A Article
A-Universal-TCP-Socket-Class-for-Non-blocking-Serv[^]
helps me lot but this article only used to passed normal char*.
Now i want pass Whole CObarray or CObject to communicate two exe.

推荐答案

本文还介绍了如何发送二进制数据.通常的方法是使用一个或多个包含长度和数据成员的结构来定义自己的协议.这样的结构可能包含CObject类的数据成员.在接收方,可以使用接收到的数据创建一个新对象.

但是传输动态对象非常困难,因为它们通常包含其他动态对象,而这些对象不能以这种方式复制.

根据您的要求,我建议定义一个具有数据结构的协议,或使用其他方法进行进程间通信.
The article decribes also how to send binary data. The usual way is to define your own protocol using one or more structures containing length and data members. Such structures may contain the data members of a CObject class. On the receiving side, a new object can then be created using the received data.

But transferring dynamic objects is very difficult because they usually contain other dynamic objects which can''t be just copied this way.

Depending on your requirements, I suggest to define a protocol with data structures, or use other methods for interprocess communication.


这篇关于在CSocket exe通信中传递CObArray或CObject的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆