![]() |
|
ماهي طريقة ارسال الى اكثر من عميل - نسخة قابلة للطباعة +- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum) +-- قسم : منتديات دلفي للعرب التعليمية (https://delphi4arab.net/forum/forumdisplay.php?fid=3) +--- قسم : سؤال و جواب حول دلفي (https://delphi4arab.net/forum/forumdisplay.php?fid=15) +--- الموضوع : ماهي طريقة ارسال الى اكثر من عميل (/showthread.php?tid=4328) |
ماهي طريقة ارسال الى اكثر من عميل - M_Mori2010 - 05-07-2012 السلآم عليكم ورحمة الله وبركاته.... اخوتي الاعزاء ... ماهي طريقة الارسال الى اكثر من عميل حيث اني وجدت طريقة لكن فيها مشكلة ويقوم بأعطائي الخطأ التالي : List Index Out Of Bounds (1 الكود الذي استخدمته كود : procedure TForm4.redt1Change(Sender: TObject);
var
Range: IHTMLTxtRange;
i:integer;
begin
Range := ((wb1.Document AS IHTMLDocument2).body AS IHTMLBodyElement).createTextRange;
Range.collapse(false);
Range.PasteHTML(format('<p>%S<p/>',[redt1.Text]));
FlashWindow(Application.Handle, True);
if (form1.Sv1.Socket.ActiveConnections > 0) then
wb1.OleObject.Document.ParentWindow.ScrollBy(0, +1000000000);
FlashWindow(Application.Handle, True);
begin
for i := 0 to form1.Sv1.Socket.ActiveConnections-1 do
begin
Form1.sv1.Socket.Connections[0].SendText(redt1.text);
Form1.sv1.Socket.Connections[1].SendText(redt1.text);
Form1.sv1.Socket.Connections[2].SendText(redt1.text);
Form1.sv1.Socket.Connections[3].SendText(redt1.text);
Form1.sv1.Socket.Connections[4].SendText(redt1.text);
Form1.sv1.Socket.Connections[5].SendText(redt1.text);
Form1.sv1.Socket.Connections[6].SendText(redt1.text);
Form1.sv1.Socket.Connections[7].SendText(redt1.text);
wb1.OleObject.Document.ParentWindow.ScrollBy(0, +1000000000);
FlashWindow(Application.Handle, True);
redt1.Clear;
end;
end;
end;شكراً لكم ماهي طريقة ارسال الى اكثر من عميل - M_Mori2010 - 06-07-2012 اخوتي الاعزاء وجدت الحل : كود : var
i: integer;
begin
Str:=Edit1.Text;//Take the string (message) sent by the server
Memo1.Text:=Memo1.Text+'me: '+Str+#13#10
Edit1.Text:='';//Clears the edit box
//Sends the messages to all clients connected to the server
for i:=0 to ServerSocket1.Socket.ActiveConnections-1 do
ServerSocket1.Socket.Connections[i].SendText(str);//Sent
end;يجب كتابة الكود على الشكل التالي فقط :d شكراً للجميع |