Communication between applications

2019-04-28 23:05发布

I have 3 choices to use : sockets, activeX, com , in order to communicate between applications on one computer. Which is faster ?

8条回答
叼着烟拽天下
2楼-- · 2019-04-28 23:15

It's hard to say which is faster, but using COM is certainly the most flexible of the choices you listed. Unless you like grovelling through byte streams.

查看更多
成全新的幸福
3楼-- · 2019-04-28 23:17

Well, think about it - socket is the lowest level, COM is using sockets, ActiveX is using COM. So which one is faster? Of course, sockets. But that is only if you are asking about program execution speed and data transfer rates. Developing programs using sockets, however, can be much harder if you don't know what you are doing. Not to mention that you possibly can come up with some bad implementation that will be worse than COM. Also, there are not that much of reusable components you can get for sockets as you get using ActiveX, not to mention that if you want to communicate with MS Office, you will have to use COM.

查看更多
We Are One
4楼-- · 2019-04-28 23:19

You don't give much detail about what you're trying to do or what considerations you need to make. For example, by "fast" do you mean high bandwidth? Low latency? Is there a possibility you might need to communicate across computers later? Etc.

That said, ActiveX is a special case of COM (introduction to activeX). If you're familiar with COM or ActiveX already, and depending on what exactly you're trying to do, you may be able to get away with writing relatively little code because MS dev tools can handle a lot of it for you.

If you're not familiar with it though, it's a fairly complex technology that may be tricky to wrap your head around. So if you're just trying to implement some basic inter-process communication it may be easier to go with sockets. On the other hand, that may require more low level work on your part.

查看更多
走好不送
5楼-- · 2019-04-28 23:26

Hi can you use shared memory? Even Oracle use shared memory in their products. Shared memory is fast.

查看更多
家丑人穷心不美
6楼-- · 2019-04-28 23:27

I would also delegate the IPC to a framework e.g. ACE (adaptive communication framework). Ace's implementation for example, is stable and it's cross platform.

查看更多
你好瞎i
7楼-- · 2019-04-28 23:31

ActiveX is more or less a fancy marketing name on COM (an ActiveX component / control is an object that just supports the IUnknown interface), so your choice is really down to COM vs Socket.

For cross process communication, you can write something faster with sockets... if you're a good socket and Windows programmer, because you will be on your own, as Sockets will basically do nothing to help you. That does not mean COM is not fast, or has bad performance, but you always theoretically can do better than an out-of-the-box system, but only if you master the whole thing.

On last thing, if you need to communicate with 3rd party products or other platforms than Windows, Sockets are more portable.

查看更多
登录 后发表回答