Basic network communication example with QTcpSocket, QUdpSocket, and QTcpServer.
A Qt project that supports listening to messages over socket.
-
The IP Address and Port Number are runtime input from the user. Send messages to any IP-port combination.
- The message to send is an input from a
textEdit
box.
- The message to send is an input from a
-
Supports both TCP and UDP communications.
-
Also contains functionality to create a Server.
- Listens to both UDP messages as well as TCP message simultaneously. (priority to TCP - keeps reading while
bytesAvailable
) - You can view the last 10 messages sent to the server in a
QMessageBox
.
- Listens to both UDP messages as well as TCP message simultaneously. (priority to TCP - keeps reading while
-
UI/UX is bae.
-
WYSIWYG - check out the Gallery to see what it does.
- Open the
.pro
file from within Qt Creator - Run the project
- Disable the last line within the
.pro
file to get qDebug() statements in a separate console window.
- The UDP connection happens over a single QUdpSocket right now. Need to look into improving the implementation with two sockets instead of just one.