Cross-Platform GUI Programming with wxWidgets
|
Chapter 18. Programming with wxSocket
A socket is a conduit for data. A socket doesn't care what kind of data passes through it, where the data is going, or where the data is coming from; its goal is to transport data from point A to point B. Sockets are used every time you surf the web, check your email, or sign on to an instant messenger. One of the neatest aspects of sockets is that they can be used to connect any two devices that support sockets, even if one of them is a computer and the other is a refrigerator! The socket API was originally a part of the BSD Unix operating system, and because that socket API originated from only one source, it has become the standard. All modern operating systems offer a socket layer, providing the ability to send data over a network (such as the Internet) using common protocols such as TCP or UDP. Using wxWidgets' wxSocket classes, you can reliably communicate any amount of data from one computer to another. This chapter assumes some basic socket terminology knowledge, but socket operations are generally straightforward. Even though the basic socket features and functions are very similar on Windows, Linux, and Mac OS X, each socket API implementation has its own nuances, usually necessitating platform-specific tweaks. More importantly, event-based sockets have very different APIs from one platform to the next, often making it a significant challenge to use them. wxWidgets provides socket classes that make it easy to use sockets in advanced applications without having to worry about platform-specific implementations or quirks. Please note that wxWidgets does not, at the time of this writing, support sending and receiving datagrams using the UDP protocol. Future releases of wxWidgets might add UDP capabilities. |
|