Start with a simple client-server example. It's very easy with Qt framework. For example:
server.cpp:
#include <QTcpSocket>
#include <QTcpServer>
int main()
{
QTcpServer *tcpServer = new QTcpServer(); //creates TCP-based server
tcpServer->listen(QHostAddress("172.16.254.1"),5300); //listen on your IP adress, port 5300
while ( tcpServer->isListening() ) //while server is listening
{
QTcpSocket* tcpSocket; //define TCP-based socket
tcpServer->waitForNewConnection(); //server waits for connection
if ( (tcpSocket = tcpServer->nextPendingConnection()) ) //if there are connections to be processsed
{
tcpSocket->write("hello",6); //write "hello" to the socket, client is connected to
tcpSocket->flush();
}
}
}
client.cpp:
#include <QDebug>
#include <QTcpSocket>
int main()
{
QTcpSocket *tcpSocket = new QTcpSocket(); //create TCP-based socket
tcpSocket->connectToHost("172.16.254.1",5300); //connect socket to server
tcpSocket->waitForConnected(); //wait
tcpSocket->waitForReadyRead();
qDebug() << tcpSocket->readAll();
}
All you need to do is to run the first program in one terminal window, and the second in the other.
You will find more Qt network examples here