1.Udp
client:
QUdpSocket* sender = new QUdpSocket(this);
QByteArray datagram = "hello world!";
//调用writeDatagram函数来发送数据
sender->writeDatagram(datagram.data(), datagram.size(),
QHostAddress::Broadcast, 45454);//给对应端口发送信息(const char*)
server:
QUdpSocket* receiver = new QUdpSocket(this);
receiver->bind(45454, QUdpSocket::ShareAddress);//绑定端口
connect(receiver, &QUdpSocket::readyRead, this, &MyServer::processPendingDatagram);//回调监听端口,连接响应槽函数
2.Tcp
3.Http
4.FTP
5.串口编程