How to exchange data between two programs?

2007-08-14 9:53 am
How can programs (Visual Studio C++ for particular) exchange data in runtime continuously? Please introduce library or functions required.

回答 (2)

2007-08-14 9:09 pm
✔ 最佳答案




The terminology of "exchanging data between programs" is "interprocess communications" (IPC).



The program supplying data is the server and the one requesting data is the client.



There are many protocols available to Visual C++ on the Windows platform for IPC. Please click the link on each of them for details:




IPC with local processes:



Clipboard a set of functions and messages that enable applications to transfer data.
Component Object Model (Object Linking & Embedding) is a platform-independent, distributed, object-oriented system for creating binary software components that can interact. COM is the foundation technology for Microsoft's OLE (compound documents) and ActiveX® (Internet-enabled components) technologies, as well as others.
Data Copy provides a WM_COPYDATA message that enables you to send data from one application to another.
Dynamic Data Exchange (DDE) is a set of messages and guidelines which sends messages between applications that share data and uses shared memory to exchange data between applications.
DDE Management Library (DDEML) provides an interface that simplifies the task of adding DDE capability to an application.
File Mapping is the association of a file's contents with a portion of the virtual address space of a process amd the system creates a file mapping object (also known as a section object) to maintain this association.
Mailslots is a mechanism for one-way interprocess communications: Applications can store messages in a mailslot and the owner of the mailslot can retrieve messages that are stored there.
Pipes is a section of shared memory that processes use for communication.



IPC with remote processes:



Remote Procedure Call (RPC) can formally specify an interface to the remote procedures using a language designed for this purpose.
Windows Sockets 2 (Winsocks2) Windows Sockets 2 (Winsock) enables programmers to create advanced Internet, intranet, and other network-capable applications to transmit application data across the wire, independent of the network protocol being used.
Distributed Component Object Model (DCOM) extends the Component Object Model (COM) to support communication among objects on different computers—on a local area network (LAN), a wide area network (WAN), or even the Internet.






Reference:



Interprocess Communications


參考: Personal experience
2007-08-14 10:14 am
I guess the "exchange data" you mean is sending data from one point to another.
If that is the case, socket whill be the one you need. However, if you are running two applications on the same pc, you have one more option. You can use file to exchange data, one application writes data into file on file system, another reads the file you have written.

If you want something that does more than just exchanging data, look at web services.
參考: Me


收錄日期: 2021-04-13 13:03:56
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20070814000051KK00498

檢視 Wayback Machine 備份