Autor Beitrag
ebi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: So 27.10.02 16:26 
ausblenden Quelltext
1:
Client: array [1..maxBenutzer] of String;					

oder
ausblenden Quelltext
1:
Client: array [1..maxBenutzer] of TClientSocket;					

was man auch immer braucht!



Ich will <ClientAnzahl: integer;> neue Komponenten erstellen
und denen dann folgende Werte und Prozeduren zuweisen:

ausblenden Quelltext
1:
2:
3:
      Port := Port;   //Port ist eine Konstante
      Host := Benutzer[i].IP;
      Open;


So in dem Sinne sollte die Prozedur aussehen:


ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
begin
  for i := 1 to ClientAnzahl do
  begin
      
      
  
  end;

end;

-----------------------------------------

Später sollen die dann so angesprochen werden:



ausblenden Quelltext
1:
2:
3:
for i := 1 to ClientAnzahl do
    TClientSocket(FindComponent('Client' +
  IntToStr(i))).Socket.SendBuf(sChat,sizeof(sChat));





Ich selbst bekomme das nicht hin.

_________________
Greetings EBI
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: So 27.10.02 20:03 
Hallo,

ich würde dir gerne helfen. Aber leider verstehe ich Dein Problem nicht. Versuch mal das Problem genauer zu beschreiben!

Gruß
TINO
ebi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Mo 28.10.02 21:49 
Ich will verschiedene Komponenten erzeugen. (create)

CLIENT1
CLIENT2
CLIENT3
CLIENT4
...

Und das in einer FOR Schleife.

Sooo einfach. :-)

Die dann auch später wieder in einer For Schleife ansprechen können, wobei die Zahl durch die Variable (i) der FOR Schleife ersetzt werden soll.

IDEEN???

:roll:

_________________
Greetings EBI
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Di 29.10.02 01:44 
Hallo,

du kannst als erstes eine Variable definieren:
ausblenden Quelltext
1:
Client: Array [1..maxBenutzer] of TClientSocket;					

Das erzeugen dieser Komponenten machst Du dann, wie Du schon geschrieben hast, in einer For-Next-Schleife:
ausblenden Quelltext
1:
2:
For Idx := 1 To maxBenutzer Do
  Client [Idx] := tClientSocket.Create (...);

Später kannst Du dann genau so auf diese Komponenten zugreifen:
ausblenden Quelltext
1:
2:
3:
4:
5:
For Idx := 1 To maxBenutzer Do
  With Client [Idx] Do
    Begin
      {...}
    End;

Gruß
TINO