Autor Beitrag
benedikt124
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: Do 09.10.08 17:33 
Hallo liebe Entwickler Ecke,

ich schreibe gerade ein kleines programm, welches erstmal nur in einer Memo die Antwort eines Gameservers anzeigen soll.

Das sieht folgendermaßen aus:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, IdBaseComponent, IdComponent, IdUDPBase, IdUDPClient, IdSocketHandle, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    IdUDPClient1: TIdUDPClient;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}



procedure TForm1.Button1Click(Sender: TObject);
var Buffer: Array [0..8192of Byte ; 
    i, j: integer;
    strTemp: string;
    str1: string;
    readAgain: boolean;

begin
  IdUDPClient1.Port := 28426;  // GameQueryPort
  IdUDPClient1.Active := true;
  IdUDPClient1.BufferSize := 8192;
  IdUDPClient1.Send('\\status\\');
  IdUDPClient1.ReceiveBuffer( Buffer, 8192);
  j := 0;
  for i := 0 to length(Buffer) do begin
    str1 := Char(Buffer[i]);
    strTemp := strTemp + str1;
  end;
  IdUDPClient1.Active := false;
  Memo1.Lines.Text := strTemp;


end;


Nun wenn ich den Query "status" an den Server sende, bekomme ich nur "ÿÿÿÿdisconnectwlPwlÄ" zurück.

Was hat das zu bedeuten? Warum?

Danke schonmal im Voraus

Moderiert von user profile iconAXMD: Code- durch Delphi-Tags ersetzt
LexXis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 170
Erhaltene Danke: 3



BeitragVerfasst: Do 09.10.08 17:49 
Was sagt denn das Protokol das der Server benutzt dazu? Das sollte ja irgendwo zu finden sein, immerhin weißt du ja schon was für eine Anforderung du an selbigen schicken musst.
Um was für ein Game handelt es sich denn?

mfg
benedikt124 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: Do 09.10.08 17:55 
Hallo,

es handelt sich um Call of Duty 4. Das Protokoll des Servers ist aus...

Ich kann dir nur sagen was in der Gameserver Konsole steht und da steht gar nix ;(
LexXis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 170
Erhaltene Danke: 3



BeitragVerfasst: Do 09.10.08 18:16 
So, nach 10 mins googlen:

Das Protokol hab ich auch die schnelle nicht aufgetrieben, allerdings ein PHP-Script, dass deine gewünschten Daten ausliest.
Wenn du dich ein bischen bemühst, kannst du das sicher in Delphi übersetzen :)

mfg
benedikt124 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: Do 09.10.08 18:32 
Okey,

ich hab mir das PHP-Script angeschaut. Im Prinzip habe ich das ja schon soweit bis zum senden des Querys.

Der einzige unterschied ist, dass in PHP dashier gesendet wird: xFF\xFF\xFF\xFFgetstatus\x00.

Das ergibt jedoch dass selbe resultat: ÿÿÿÿdisconnectw˜
LexXis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 170
Erhaltene Danke: 3



BeitragVerfasst: Do 09.10.08 18:59 
user profile iconbenedikt124 hat folgendes geschrieben Zum zitierten Posting springen:
xFF\xFF\xFF\xFFgetstatus\x00


Du hast das nicht als String verschickt, oder? o_O
Falls ja: Falsch! ;)
Das Delphi-Äquivalent dazu wäre
ausblenden Delphi-Quelltext
1:
2:
3:
4:
var
  senden: String;
{...}
  senden := $FF$FF$FF$FF+'getstatus'+$00;
benedikt124 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: Do 09.10.08 19:14 
Ähm,

ich habe das jetzt mal so eingefügt:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
procedure TForm1.Button1Click(Sender: TObject);
var Buffer: Array [0..8192of Byte ;
    i, j: integer;
    strTemp: string;
    str1: string;
    readAgain: boolean;
    senden: String;

begin
  senden := $FF$FF$FF$FF+'getstatus'+$00;
  IdUDPClient1.Port := 28426;  // GameQueryPort
  IdUDPClient1.Active := true;
  IdUDPClient1.BufferSize := 8192;
  IdUDPClient1.Send(senden);
  IdUDPClient1.ReceiveBuffer( Buffer, 8192);
  j := 0;
  for i := 0 to length(Buffer) do begin
    str1 := Char(Buffer[i]);
    strTemp := strTemp + str1;
  end;
  IdUDPClient1.Active := false;
  Memo1.Lines.Text := strTemp;


end;


Ist das so korrekt? Falls ja geht es nämlich nicht: Fehler: Operator oder Semikolon fehlt ...

Moderiert von user profile iconAXMD: Code- durch Delphi-Tags ersetzt
Nico72
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 50

Win XP, Vista
Delphi 7, Delphi 2006
BeitragVerfasst: Do 09.10.08 20:03 
Hallo,

$FF ist ja auch Integer. Mach mal überall ein # davor, also #$FF#$FF#$FF... Und hinten natürlich #$00 (oder #00).
benedikt124 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: Do 09.10.08 20:08 
Cool es geht alles klar vielen Dank Nico und Lexxis