Re: [twsocket] pop3 and lastresponse

2010-09-19 Thread Arno Garrels
Zvone wrote:
 IMO the component should clear LastResponse on before connect.
 
 Maybe it should, but what it does is different story :)

Yes, it has to be fixed IMO. 

 So what about a numeric property LastErrorNumber?
 
 There is no such property nowhere in pop3 (or in any ICS file).

That was a feature suggestion for a new property LastRequestError
and perhaps a new property LastRequestType.
Will look at it more closly when I have some more time. 

-- 
Arno Garrels
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Experimental throttle ( was pop3 and lastresponse)

2010-09-19 Thread Arno Garrels
Zvone wrote:
 
 something, worth to be tested anyway:
 [...]
 
 I'll take a look and test this code soon enough. Thanks.

Try the change below instead, otherwise you might get Integer 
overflow exceptions.
It happens that even though the socket is paused the component
receives data after it got a close notify message. When we Pause
the socket there may still be notify messages from Winsock
in the message queue, so be prepared that the throttle and timeout
might not work reliable always. 

{code}

function TCustomThrottledWSocket.RealSend(var Data: TWSocketData;
  Len: Integer): Integer;
begin
if FBandwidthEnabled and (Len  0) and
   (FBandwidthCount  FBandwidthMaxCount) and
   (FBandwidthCount + LongWord(Len)  FBandwidthMaxCount) then
Len := (FBandwidthMaxCount - FBandwidthCount) + 1;

Result := inherited RealSend(Data, Len);

if FBandwidthEnabled and (Result  0) then begin
Inc(FBandwidthCount, Result);
if (FBandwidthCount  FBandwidthMaxCount) and
   (not FBandwidthPaused) then begin
FBandwidthPaused := TRUE;
Pause;
end;
end;
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
function TCustomThrottledWSocket.Receive(Buffer: TWSocketData;
  BufferSize: Integer): Integer;
begin
if FBandwidthEnabled and (BufferSize  0) and
   (FBandwidthCount  FBandwidthMaxCount) and
   (FBandwidthCount + LongWord(BufferSize)  FBandwidthMaxCount) then
BufferSize := (FBandwidthMaxCount - FBandwidthCount) + 1;

Result := inherited Receive(Buffer, BufferSize);

if FBandwidthEnabled and (Result  0) then begin
Inc(FBandwidthCount, Result);
if (FBandwidthCount  FBandwidthMaxCount) and
(not FBandwidthPaused) then begin
FBandwidthPaused := TRUE;
Pause;
end;
end;
end;
{code}


--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be