
Originally Posted by
TheMasterNico
First problem I see is that you're not sending the exact same data to your server. In your PHP example, you send 11 bytes of data. In your QUdpSocket code, you wind up sending 12 bytes of data, because QChar is a 16-bit unicode type and when you add the QChar for 214, it winds up appending two bytes to your QByteArray instead of one.
I used the code below and got a response from your server. The Wireshark capture for the exchange is shown below as well.
Data.append("SAMP");
Data.append(93);
Data.append(119);
Data.append(26);
Data.append(214);
Data.append(7777 & 0xFF);
Data.append(7777 >> 8 & 0xFF);
Data.append('i');
int bytes_written
= s.
writeDatagram(Data,
QHostAddress("93.119.26.214"),
7777);
QUdpSocket s;
QByteArray Data; // Message for send
Data.append("SAMP");
Data.append(93);
Data.append(119);
Data.append(26);
Data.append(214);
Data.append(7777 & 0xFF);
Data.append(7777 >> 8 & 0xFF);
Data.append('i');
int bytes_written = s.writeDatagram(Data, QHostAddress("93.119.26.214"), 7777);
To copy to clipboard, switch view to plain text mode
No. Time Source Destination Protocol Length Info
1 0.000000000 172.20.28.17 93.119.26.214 UDP 43 Source port: 7777 Destination port: 7777
Frame 1: 43 bytes on wire (344 bits), 43 bytes captured (344 bits) on interface 2
Null/Loopback
Internet Protocol Version 4, Src: 172.20.28.17 (172.20.28.17), Dst: 93.119.26.214 (93.119.26.214)
User Datagram Protocol, Src Port: 7777 (7777), Dst Port: 7777 (7777)
Data (11 bytes)
0000 53 41 4d 50 5d 77 1a d6 61 1e 69 SAMP]w..a.i
Data: 53414d505d771ad6611e69
[Length: 11]
No. Time Source Destination Protocol Length Info
2 0.194495000 93.119.26.214 172.20.28.17 UDP 138 Source port: 7777 Destination port: 7777
Frame 2: 138 bytes on wire (1104 bits), 138 bytes captured (1104 bits) on interface 2
Null/Loopback
Internet Protocol Version 4, Src: 93.119.26.214 (93.119.26.214), Dst: 172.20.28.17 (172.20.28.17)
User Datagram Protocol, Src Port: 7777 (7777), Dst Port: 7777 (7777)
Data (106 bytes)
0000 53 41 4d 50 5d 77 1a d6 61 1e 69 00 04 00 94 00 SAMP]w..a.i.....
0010 32 00 00 00 50 72 6f 66 65 73 73 69 6f 6e 61 6c 2...Professional
0020 20 52 6f 6c 65 70 6c 61 79 20 7c 20 70 72 6f 2d Roleplay | pro-
0030 72 6f 6c 65 70 6c 61 79 2e 72 6f 20 5b 30 2e 33 roleplay.ro [0.3
0040 2e 37 20 52 33 5d 12 00 00 00 52 6f 6c 65 70 6c .7 R3]....Rolepl
0050 61 79 20 31 39 2e 30 2e 33 2e 37 69 0a 00 00 00 ay 19.0.3.7i....
0060 4c 6f 73 20 53 61 6e 74 6f 73 Los Santos
Data: 53414d505d771ad6611e6900040094003200000050726f66.. .
[Length: 106]
And the attachment here if you prefer:
pcap.txt
Bookmarks