QByteArray datagram;QDataStream out(&datagram, QIODevice::WriteOnly);int d = 10;out << d;f_udp_socket.writeDatagram(datagram, QHostAddress::LocalHost, 6000);
WSADATA wsaData;WSAStartup(MAKEWORD( 2, 0 ), &wsaData );struct sockaddr_in address;int reciever = socket(AF_INET, SOCK_DGRAM, 0);address.sin_family = AF_INET;address.sin_port = htons(6000);address.sin_addr.S_un.S_addr = htonl(INADDR_ANY);bind(reciever, (struct sockaddr*)&address, sizeof(address));int data;while(true) int bytes = recv(reciever, (char*)&data, sizeof(data), 0);
f_udp_socket.write(&d, sizeof(d), QHostAddress::LocalHost, 6000);