server = new QUdpSocket();server.bind(QHostAddress("192.168.0.255"), 12345);connect(server, SIGNAL(readyRead()), SLOT(onServerReadyRead()));
client = new QUdpSocket();connect(client, SIGNAL(readyRead()), SLOT(onClientReadyRead()));client->writeDatagram("Servers, where are you?", QHostAddress("192.168.0.255"), 12345 );
QHostAddress sender;quint16 senderPort;server->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort);
server->writeDatagram(datagram.data(), datagram.size(), &sender, &senderPort);
client->bind(QHostAddress("192.168.0.10"), 4321)
client->bind(QHostAddress("192.168.0.255"), 4321)