Autor Beitrag
Bailey
Hält's aus hier
Beiträge: 1

XP Proffesional
Delphi 7
BeitragVerfasst: So 13.03.05 10:07 
Kann jemmand einen Tip geben wie ich einen Record mit idUDPclient unter Indy 10 versende..!?
Querkopf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 31

Win XP SP2
Turbo Delphi 2006 Explorer
BeitragVerfasst: Mo 29.05.06 21:28 
Auch wenn der Thread schon etwas älter ist, würds mich auch brennend interessieren! Hab leider bisher nichts darüber finden können. Wäre zumindest mal schön, wenn jemand sagt, geht (und dann auch wie ;) ) oder geht nicht.

Gruss,

Pierre
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 29.05.06 22:32 
Moin!

Ja, kann man. ;) Allerdings rate ich - wie immer :roll: - vom Versenden von records ab! :mahn: Warum steht hier. Statt dessen solltest du dich mal mit einem Suche in: Delphi-Forum, Delphi-Library PROTOKOLL vertraut machen. ;)

Falls du nicht auf die Indies angewiesen bist, könnte das hier auch interessant für dich sein; ist sogar mit Tutorial. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.


Zuletzt bearbeitet von Narses am So 04.06.06 23:30, insgesamt 1-mal bearbeitet
Querkopf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 31

Win XP SP2
Turbo Delphi 2006 Explorer
BeitragVerfasst: Mi 31.05.06 15:02 
Hi,

danke für Deine Antwort.

Das mit dem Protokoll ist soweit klar, denke ich. Ich habe jetzt mal versucht, das Record in einen String umzusetzen, den ich versende. Die Struktur, die das Programm erwartet ist folgende :

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
struct InSimInit    // UDP packet to initialise the InSim system
{
  char  Id  [4];  // ISI + zero
  word  Port;    // Port for UDP replies from LFS (0...65535)
  byte  Flags;    // Bit flags for options - see below
  byte  NodeSecs;  // Number of seconds between NLP or MCI packets (0=none)
  char  Admin  [16];  // Admin password (required if set in LFS host options)
};


Ich habe jetzt erstmal folgende Konstanten :

ausblenden Quelltext
1:
2:
3:
4:
5:
const
  INSIM_INIT_ID = 'ISI'+#0;
  INSIM_FLAGS = #11;
  INSIM_NODESECS = #1;
  INSIM_ADMINPWD = 'xyz'+#0;


und dann versuche ich folgendes zu senden :

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TInSimCommunication.sendData (data : String);
begin
  udpClient.Host := '255.255.255.255';
  udpClient.Active := true;
  udpClient.BroadcastEnabled := true;
  udpClient.Send(data);
  udpClient.BroadcastEnabled := false;
end;

constructor TInSimCommunication.create (port : word);
// erzeugt ein neues Kommunikationsobjekt der Klasse und initialisiert die Werte
begin
  udpClient := TIdUDPClient.Create(nil);
  udpClient.Port := port;
  sendData(INSIM_INIT_ID+#0+#0+INSIM_FLAGS+INSIM_NODESECS+INSIM_ADMINPWD)
//  sendData(INSIM_INIT_ID+#0+#0+INSIM_FLAGS+INSIM_NODESECS+INSIM_ADMINPWD+#13) auch schon versucht
end.


Die beiden #0-Bytes repräsentieren das Word (den Port). Port 0 bedeutet (für das andere Programm), sende auf dem gleichen Port wie empfangen wird.

Ergebnis :

Das andere Programm empfängt meine Daten, gibt allerdings die Meldung 'Packet received before ISI packet', also gehen ich davon aus, dass ich das Record (oder auch das struct) noch nicht 100%ig richtig umgesetzt habe.

Oder ich habe einen anderen Denkfehler.

Gruss, Pierre
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 31.05.06 15:30 
Moin!

Ausser, dass dein Admin-Password-String nicht 16 Bytes lang ist, wie in der Struktur vorgesehen, kann ich keinen Unterschied sehen.

Scheint, du solltest dich etwas mehr mit der Doku des Objektes beschäftigen, das du da zu kontaktieren versuchst. ;)

Alternative: mach einen UDP-Server auf und schick dir die Daten, dann zeigst du das als hex-String an, dann hast du auf jeden Fall die Garantie, dass du das sendest, was du senden wolltest. :D

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Querkopf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 31

Win XP SP2
Turbo Delphi 2006 Explorer
BeitragVerfasst: Mi 31.05.06 15:37 
Hi,

nun ja, xyz war ja auch nur ein Platzhalter ;)

und sonderlich mehr ist dann nicht in der Doku vorhanden.

dennoch danke, werds mal mit dem Server-Test probieren.

Gruss,

Pierre
Querkopf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 31

Win XP SP2
Turbo Delphi 2006 Explorer
BeitragVerfasst: Mi 31.05.06 17:53 
So, hab nochmal nachgezählt, das Passwort war tasächlich ein Byte zu kurz :autsch:

Nu klappts, so wies soll.

Danke!
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 01.06.06 00:37 
Moin!

Markierst du dann den Thread noch entsprechend, wenn dein Problem gelöst ist? Danke. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Querkopf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 31

Win XP SP2
Turbo Delphi 2006 Explorer
BeitragVerfasst: Do 01.06.06 13:13 
Würde ich gerne, ist aber nicht mein Thread ;)
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 01.06.06 13:37 
Moin!

Umpf, stimmt... :? ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.