procedure Get_SERVER_LIST;
var
request: TInfoRequest;
response: TServerListResponse;
buffer: TBufferArray;
i: Integer;
y: integer;
begin
// Abfrage der Arma 2 OA Server
// Example
// 31 FF 30 2E 30 2E 30 2E 30 3A 30 00 5C 6E 61 70 70 5C 35 30 30 00
// Tests
// 1˙0.0.0.0:0\x00\gamedir\arma2arrowpc\x00
// 31 ff 30 2e 30 2e 30 2e 30 3a 30 5c 78 30 30 5c 67 61 6d 65 64 69 72 5c 61 72 6d 61 32 61 72 72 6f 77 70 63 5c 78 30 30
// 1˙0.0.0.0:0\x00\gamedir\arma2arrowpc\x00
// 31 ff 30 2e 30 2e 30 2e 30 3a 30 5c 30 30 5c 67 61 6d 65 64 69 72 5c 61 72 6d 61 32 61 72 72 6f 77 70 63 5c 30 30
// 1˙0.0.0.0:0\00\gamedir\arma2arrowpc\00
// 31 ff 30 2e 30 2e 30 2e 30 3a 30 5c 30 5c 67 61 6d 65 64 69 72 5c 61 72 6d 61 32 61 72 72 6f 77 70 63 5c 30
// 1˙0.0.0.0:000\gamedir\arma2arrowpc00
// 31 ff 30 2e 30 2e 30 2e 30 3a 30 30 30 5c 67 61 6d 65 64 69 72 5c 61 72 6d 61 32 61 72 72 6f 77 70 63 30 30
// 1˙0.0.0.0:0ß\gamedir\arma2arrowpcß
// 31 ff 30 2e 30 2e 30 2e 30 3a 30 df 5c 67 61 6d 65 64 69 72 5c 61 72 6d 61 32 61 72 72 6f 77 70 63 df
// 1˙0.0.0.0:00\gamedir\arma2arrowpc0
// 31 ff 30 2e 30 2e 30 2e 30 3a 30 30 5c 67 61 6d 65 64 69 72 5c 61 72 6d 61 32 61 72 72 6f 77 70 63 30
request.Payload[0] := $31;
request.Payload[1] := $FF;
request.Payload[2] := $30;
request.Payload[3] := $2E;
request.Payload[4] := $30;
request.Payload[5] := $2E;
request.Payload[6] := $30;
request.Payload[7] := $2E;
request.Payload[8] := $30;
request.Payload[9] := $3A;
request.Payload[10] := $00;
request.Payload[11] := $30;
request.Payload[12] := $5C;
request.Payload[13] := $67;
request.Payload[14] := $61;
request.Payload[15] := $6D;
request.Payload[16] := $65;
request.Payload[17] := $64;
request.Payload[18] := $69;
request.Payload[19] := $72;
request.Payload[20] := $5C;
request.Payload[21] := $61;
request.Payload[22] := $72;
request.Payload[23] := $6D;
request.Payload[24] := $61;
request.Payload[25] := $32;
request.Payload[26] := $61;
request.Payload[27] := $72;
request.Payload[28] := $72;
request.Payload[29] := $6F;
request.Payload[30] := $77;
request.Payload[31] := $70;
request.Payload[32] := $63;
request.Payload[33] := $00;
Form1.udp1.BlockMode := bmNonBlocking;
Form1.udp1.RemoteHost:= '
hl2master.steampowered.com';
Form1.udp1.RemotePort:= '
27011';
Form1.udp1.Open;
if (Form1.udp1.Connected)
then
begin
Form1.Udp1.SendBuf(request.Payload, SizeOf(request.Payload));
Form1.udp1.WaitForData(250);
Form1.Udp1.ReceiveBuf(buffer, SizeOf(buffer));
i := 0;
Move(buffer[i], response.ResponseHeader, SizeOf(response.ResponseHeader)); inc(i, SizeOf(response.ResponseHeader));
form1.ListBox1.Clear;
for y := 0
to 255
do
begin
Move(buffer[i], response.First, SizeOf(response.First)); inc(i, SizeOf(response.First));
Move(buffer[i], response.Secound, SizeOf(response.Secound)); inc(i, SizeOf(response.Secound));
Move(buffer[i], response.Third, SizeOf(response.Third)); inc(i, SizeOf(response.Third));
Move(buffer[i], response.Fourth, SizeOf(response.Fourth)); inc(i, SizeOf(response.Fourth));
Move(buffer[i], response.Port, SizeOf(response.Port)); inc(i, SizeOf(response.Port));
Form1.ListBox1.Items.Add(Inttostr(response.First) + '
.' + Inttostr(response.Secound) + '
.' + inttostr(response.Third) + '
.' + inttostr(response.Fourth) + '
:' + FloatToStr(response.Port));
Application.ProcessMessages;
end;
end;
Form1.udp1.Active := false;
end;