Вот код udpSocket = new QUdpSocket(this); groupAddress = QHostAddress("239.255.43.21"); if(!udpSocket->bind(QHostAddress(QHostAddress::AnyIPv4), portMulti, QUdpSocket::ReuseAddressHint|QUdpSocket::ShareAddress)) { qDebug() <<"Бида все пропало1"; } if(!udpSocket->joinMulticastGroup(groupAddress)) { qDebug() <<"Бида все пропало2"; } connect(udpSocket, SIGNAL(readyRead()),this,SLOT(processPendingDatagrams())); On linux, this code works without problems, but on windows it works only if I enter both the server’s internal ip server’s address into the server and the client (192.158.0.102 well, or there that you understand that), if I enter other ipes, nothing works, say what I’m doing so how to fix it please. Really needed.
I throw the code from the android client, someone may want to know what is netak, I have no idea why it works only Linuxe.
socket = new DatagramSocket(/*45454*/); socket.setBroadcast(true); InetAddress groupAddr = InetAddress.getByName("239.255.43.21"); //на этом (выдуманный) работает только на linux //InetAddress groupAddr = InetAddress.getByName("192.168.0.102"); //на этом адресе работает byte[] outbuf = makeStartPacket(); sendPacket(socket, groupAddr, outbuf); private byte[] makeStartPacket() { byte[] outPack = ("Ляляля").getBytes(); return outPack; } private void sendPacket(DatagramSocket socket, InetAddress groupAddr, byte[] outbuf) throws IOException { DatagramPacket packet; packet = new DatagramPacket(outbuf, outbuf.length, groupAddr, /9901//2425//multiPort/45455); //outbuf = createLegacyDiscoveryRequest(socket); socket.send(packet); The problem is found, but a solution is needed. The trouble is that I installed genymotion, genymotion installed virtualbox, virtualbox installed more network adapters interfaces, well, the Network and Sharing Center-> Adapter parameter changes, + 2 adapters were added there. When I tested without these adapters, or on linux, the server is apparently connected. to 1 network interface correct, as it is. But when there were a lot of them, an error occurred. But how now, fix it all, tried to connect interfaces yet does not help, and what to connect? It is necessary correct, the solution the code is shorter, with a detour of this problem. In advance, the greatest ATP if anyone can help.