Cross-Platform GUI Programming with wxWidgets
|
Alternatives to wxSocket
Although wxSocket provides a lot of flexibility and is nicely integrated into wxWidgets, it's not the only method you can use to communicate with other processes. If you just want to perform FTP or HTTP operations, you can use wxFTP or wxHTTP, which use wxSocket. However, these classes are incomplete, and you may be better off using CURL, a popular library that gives you a very straightforward API for transferring files using a variety of common Internet protocols. There is even a wxWidgets wrapper for CURL available, called wxCURL. wxWidgets also provides a high-level interprocess communication facility that uses the classes wxServer, wxClient, and wxConnection and an API based on Microsoft's DDE (Dynamic Data Exchange) protocol. In fact, on Windows, these classes use DDE, and on other platforms, sockets. The main advantage of using this higher-level API is its ease of use compared with using wxSocket. Another advantage is that on Windows, your applications can be DDE-aware, and other applications (not necessarily written with wxWidgets) can access it. A disadvantage is that on platforms other than Windows, it is not a recognized protocol to which non-wxWidgets applications can easily conform. However, if you just need to communicate between two wxWidgets applications, it can fit the bill. We show a very simple example in the section "Single Instance or Multiple Instances?" in Chapter 20, "Perfecting Your Application." For more information, please refer to the topic "Interprocess Commun-ication Overview" in the reference manual and the source in samples/ipc in your wxWidgets distribution. You can also see these classes in action in the standalone help viewer in utils/helpview/src, again in the wxWidgets distribution. |
|