 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
md_wes Guest
|
Posted: Mon Aug 07, 2006 1:26 pm Post subject: TIdTCPServer blocking |
|
|
Hello everyone!
I have a serious problem with the TIdTCPServer from INDY, that seems to
be created if i try to broadcast a message to all the clients that are
connected to it. So, the scenario is as follows: a client connects to
my server and waits for data. In the server, there are some messages
that need to be broadcasted to all the clients that are connected
(there are some more verifications that are made, but the idea is the
same). The problem is that, sometimes, the server just freezes and the
messages are no longer sent to the clients. Here is a snippet of the
code that i use for the broadcast procedure:
procedure TBroadcasterForm.DoBroadCast(linie: string);
var i: integer;
pConn: TIdTCPServerConnection;
clList: TList;
err: boolean;
begin
clList:=TCPServer.Threads.LockList;
err:=FALSE;
try
for i := 0 to clList.Count-1 do begin
try
if TIdPeerThread(clList.Items[i]).Data<>nil then
begin
pConn := TIdPeerThread(clList.Items[i]).Connection;
if (not pConn.ClosedGracefully) then
if pConn.Connected then pConn.WriteLn(linie)
end
except
on E: Exception do begin
TIdPeerThread(clList.Items[i]).Stop;
TIdPeerThread(clList.Items[i]).Terminate;
err:=TRUE;
end;//end ON
end;//end except
if err then break;
end;//end FOR
finally
TCPServer.Threads.UnlockList;
end;
end;
This procedure is called often in the server as the messages are
generated in a short interval. Could be that the server just cannot
handle all the data? Also, the data is being sent could be quite large
(string messages) but usually it is something like packets of size 3K.
What is wrong with this procedure? I cannot figure it out ... pls
help... |
|
| Back to top |
|
 |
Riki Wiki Guest
|
Posted: Thu Aug 10, 2006 2:09 am Post subject: Re: TIdTCPServer blocking |
|
|
Hoi
You need to repost your message on the Borland news server to make
everybody see it and possibly answer your message.
How to post to Delphi newsgroups:
<http://delphi.wikia.com/wiki/Delphi_Newsgroups> |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|