Autor Beitrag
Spurius
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 142

Win XP Home
D3 Prof, D7 Prof
BeitragVerfasst: Do 27.11.03 18:06 
Hallo,
ich hab einen Chat programmiert(indy tcp), und wenn ich einen Server eröffne,
kommt die Nachricht nur bei dem wieder an, der sie gesendet hat.
Der Server soll sie eigentlich an alle die connected sind senden.
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.serverExecute(AThread: TIdPeerThread);
var post: string;
begin
  post := athread.connection.readln;
  memo2.Lines.Add(post);
  athread.Connection.WriteLn(post);
end;

Was ist an meinem Code falsch?
Gruß
Spurius
barfuesser
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 324



BeitragVerfasst: Do 27.11.03 18:19 
Der Indy-Server legt für jeden verbundenen Client einen eigenen Thread (AThread) an. Jeder dieser Threads sollte nun, den eingegangenen String an alle anderen Threads weitergeben, damit diese den String an ihren Client senden können.

barfuesser
Spurius Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 142

Win XP Home
D3 Prof, D7 Prof
BeitragVerfasst: Do 27.11.03 18:26 
Hallo,
und wie kann ich das machen?
Gruß
Spurius