Autor Beitrag
barrais
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 33



BeitragVerfasst: Do 20.03.08 17:54 
Hallo zusammen,

wie kann ich binäre Daten in einem String-Buffer senden?
ausblenden Delphi-Quelltext
1:
UDPServer.SendBuffer(AHost:String;APort:String,AData:String,Length:Integer);					

wie ihr sieht die Indy-Funktion erwartet hier ein String-Parameter, wie kann ich binäre Daten darein kopieren?
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 20.03.08 18:36 
Moin!

Du könntest das mit einem TStringStream lösen, oder einfach mit SetLength Speicher für den String holen und an die Adresse der Daten (mit PChar(StrVar)^) schreiben. :nixweiss:

cu
Narses

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



BeitragVerfasst: Fr 21.03.08 12:44 
Danke,
ich wird es ausprobieren.


Zuletzt bearbeitet von barrais am Fr 21.03.08 22:04, insgesamt 1-mal bearbeitet
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Fr 21.03.08 15:17 
Moin!

Bitte nur ein Problem pro Thread. ;) (solltest du doch langsam kennen, bist ja nicht mehr ganz neu bei uns :))

cu
Narses

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



BeitragVerfasst: Fr 21.03.08 22:05 
Sorry, ich habe es rückgängig gemacht.
barrais Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 33



BeitragVerfasst: Sa 22.03.08 16:16 
Aber muss man jedes Byte manuell reinschreiben, gibt es keine andere Lösung, was ist wenn ich z.B. ein ganze "array[0..512] of byte" darein kopieren will?

Danke.
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Sa 22.03.08 16:29 
ausblenden Delphi-Quelltext
1:
Stream.Write(ArrayVariable, SizeOf(ArrayVariable);					

(Ungetestet, müsste aber funktionieren)
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Sa 22.03.08 16:32 
Moin!

Du kannst auch mit System.Move() Daten kopieren. :nixweiss:

cu
Narses

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



BeitragVerfasst: Sa 22.03.08 17:22 
Danke für eure Hilfe.