Autor Beitrag
tc4xe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 55



BeitragVerfasst: Mo 09.04.07 20:31 
Wie könnte ich vom Client zum Server eine Nachricht schicken, dass der Client diese Nachricht dann lohisch zerlegen kann.

z.B.:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
////////////////////////////////////////////////////////////////////////
ClientSocket1.Socket.Sendtext('msg' + '*' + Nachricht + '*' + Datum + '*' + Uhrzeit);

///////////////////////////////////////////////////////////////////////

MSG:=ServerSocket1.Socket.ReceiveText;

if copy(MSG,1,3)=msg then 
 begin
  Nachricht:=copy(MSG,3,bis ende vom Nachricht);
  Datum:=copy(MSG,nach dem Nachrichttext,bis ende vom Datum);
  Uhrzeit:=copy(MSG,nach dem Datum,bis ende vom Uhrzeit);
 end;
//////////////////////////////////////////////////////////////////////


Die Längen vom Nachricht,Datum und Uhrzeit sind hier nicht bekannt.
Gelesen soll immer bis '*' dann den String bis dahin zuweisen.

Wie könnte das richtig funktionieren?
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mo 09.04.07 20:33 
Mit Delete(Msg, 1, Pos('*', Msg)); das bereits abgearbeitete löschen.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
tc4xe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 55



BeitragVerfasst: Mo 09.04.07 20:55 
user profile iconGTA-Place hat folgendes geschrieben:
Mit Delete(Msg, 1, Pos('*', Msg)); das bereits abgearbeitete löschen.


In dem String sind aber mehrere *´s ,macht das einen Unterschied?
Kugelblitz
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 34

Win XP, Debian

BeitragVerfasst: Mo 09.04.07 20:58 
du müsstest diese dann halt nach der reihe durchgehen und die einzelnen strings z.b. in ein array schreiben

guck dir das hier mal an:
www.swissdelphicente...showcode.php?id=1326

die explode funtktion wie man sie aus php kennt ;)

_________________
I haven't lost my mind; it's backed up on tape somewhere!
tc4xe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 55



BeitragVerfasst: Mo 09.04.07 21:01 
user profile iconKugelblitz hat folgendes geschrieben:
du müsstest diese dann halt nach der reihe durchgehen und die einzelnen strings z.b. in ein array schreiben

guck dir das hier mal an:
www.swissdelphicente...showcode.php?id=1326

die explode funtktion wie man sie aus php kennt ;)


Danke dir, werde mir das bei swissdelphicenter angucken.
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 09.04.07 22:50 
Moin!

user profile icontc4xe hat folgendes geschrieben:
Wie könnte ich vom Client zum Server eine Nachricht schicken, dass der Client diese Nachricht dann lohisch zerlegen kann.
[...]
Wie könnte das richtig funktionieren?

Zum Beispiel mit einem Terminatorzeichenprotokoll. ;)

cu
Narses

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