BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need help with IdIOHandleThrottle on server side

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
York
Guest





PostPosted: Thu May 10, 2007 7:03 pm    Post subject: Need help with IdIOHandleThrottle on server side Reply with quote



Hello
I am trying to implement the following posted by Remy a few months ago
Throttle := TIdIOHandlerThrottle.Create(AThread.Connection);
Throttle.BytesPerSec := 1024;
{ TIdTCPConnection owns the initial TIdIOHandler, so reassign the
ownership so the IOHandler is not freed when changing the
property...}

Throttle.InsertComponent(AThread.Connection.IOHandler);
Throttle.ChainedHandler := AThread.Connection.IOHandler;
TIdTCPConnectionAccess(AThread.Connection).FFreeIOHandlerOnDisconnect :=
False;
AThread.Connection.IOHandler := Throttle;

After the code above when I try to access AThread.Connection.Socket it
returns nil

Could you help me please to throttle the connection on the server side

Thank you
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu May 10, 2007 11:22 pm    Post subject: Re: Need help with IdIOHandleThrottle on server side Reply with quote



"York" <no> wrote in message news:46432647$1 (AT) newsgroups (DOT) borland.com...

Quote:
After the code above when I try to access AThread.Connection.Socket
it returns nil

As it should be, because the Connection.IOHandler is no longer set to
a TIdIOHandlerSocket-based object anymore.

So what exactly are you having a problem with? If all you are trying
to do is access the original IOHandler, then you can reach it through
the Throttle's ChainedHandler property, ie:

var
Socket: TIdIOHandlerSocket;
begin
//...
Socket :=
TIdIOHandlerSocket(TIdIOHandlerThrottle(AThread.Connection.IOHandler).
ChainedHandler);
// use Socket as needed ...
//...
end;


Gambit
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.