Autor Beitrag
thebug
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 49



BeitragVerfasst: Mo 05.07.04 09:41 
Hallo ich habe einen Typen erstellt der folgender maßen aussieht:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
Type TMember=Record
  name:string;
  ip:string;
  msg:string;
  end;


wie kann ich diesen Typen über die server bzw client komponenter verschicken??

danke

leon

_________________
Einsicht ist der beste Weg zur Besserung
UC-Chewie
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 531

WinXP
D5 Ent
BeitragVerfasst: Mo 05.07.04 10:28 
Einfach so viele Bytes beginnend an der Adresse, an der der Record beginnt, verschicken, wie das Record groß ist (Sizeof(Record)). Problematisch wird nur die Sache mit den Strings: So schickst du nämlich nur Zeiger auf die Strings mit. Verwende als besser ShortStrings oder (statische!) Array of Char.

_________________
Egal wie dumm man selbst ist, es gibt immer andere, die noch dümmer sind
thebug Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 49



BeitragVerfasst: Mo 05.07.04 12:06 
hmm..
das heist ich kann das mit socket.sendBuf(meineTMemberVariable,sizeof(MeineTMemberVariable));
verschicken.?! wenn ich
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
Type TMember=Record

  name:string[50];

  ip:string[15];

  msg:string[170];

  end;


vereinbare...
richtig? :) :)

leon

_________________
Einsicht ist der beste Weg zur Besserung
UC-Chewie
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 531

WinXP
D5 Ent
BeitragVerfasst: Mo 05.07.04 13:09 
Genau, sollte gehen. Ich würde den Record aber sicherheitshalber als packed deklarieren.

_________________
Egal wie dumm man selbst ist, es gibt immer andere, die noch dümmer sind
thebug Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 49



BeitragVerfasst: Mo 05.07.04 13:11 
ja geht...danke :lol: :lol: :lol: :lol:

aber was meinst du mit "als packed" deklarieren?

leon

_________________
Einsicht ist der beste Weg zur Besserung
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Mo 05.07.04 13:19 
So:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
Type TMember = packed record
  name:string[50];
  ip:string[15];
  msg:string[170];
  end;

Dadurch werden die Elemente des Records nicht an Speichergrenzen ausgerichtet sondern liegen gleich hintereinander...

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!