QTcpSocket and QTcpServer are two classes for sockets used in Qt. They work in much the same way as your web browser and a WWW server. These connect to a network address host, whereas QLocalSocket and QLocalServer connect to a local file descriptor.
Let's look at QLocalServer and QLocalSocket first.
In socket server programming, the basic procedure is as follows:
- Create a socket
- Set socket options
- Bind a socket address
- Listen for connections
- Accept new connection
Qt simplifies these steps to the following:
- Create a socket
- Listen for connections
- Accept new connection