Re: [twsocket] Is this a bug or a missing feature in wsocket.pas?

2007-07-24 Thread Arno Garrels
> Abort() IMHO. Is this correct?

No, since receiving this notification from winsock does not
necessarily mean that all data has been received on the
application level.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html  

Fastream Technologies wrote:
> Hello,
> 
> I mean the FD_CLOSE() is called when a close is detected right.
> However, the last two lines calling Close() should be changed with
> Abort() IMHO. Is this correct?
> 
> Thanks,
> 
> SZ
> 
> - Original Message -
> From: "Fastream Technologies" <[EMAIL PROTECTED]>
> To: "ICS support mailing" 
> Sent: Wednesday, July 25, 2007 12:03 AM
> Subject: Is this a bug or a missing feature in wsocket.pas?
> 
> 
>> Hello,
>> 
>> In the description of winsock error 10053 which I get with my proxy,
>> I read:
>> 
>> "TCP/IP scenario: A connection will timeout if the local system
>> doesn't receive an (ACK)nowledgement for data sent. It would also
>> timeout if a (FIN)ish TCP packet is not ACK'd (and even if the FIN
>> is ACK'd, it will eventually timeout if a FIN is not returned)."
>> 
>> Is the case in the last sentence addressed by ICS? I mean, what to
>> do to sockets in CLOSE_WAIT state? I normally destruct my
>> thttpconnection instance (or send to pool) in a Postthreadmessage
>> posted in OnSessionClosed. Is there a better way to do it?
>> 
>> Best Regards,
>> 
>> SZ
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] TProxyInfo from User Made page

2007-07-27 Thread Arno Garrels
Hello Maurizio,

TProxyInfo does not parse the proxy-strings correctly
since here in W2K entries are separated by a space, I changed
below function to accept multiple separator chars.
Now when I pass separators [';', ' '] the component works fine.


procedure SplitString(const AString: string;
  const SepChars: TSysCharSet;
  ResList: TStrings);
var
  posini: integer;
  posend: integer;
  cnt: integer;
begin
  ResList.Clear;
  posini := 1;
  while posini <= Length(AString) do
  begin
posend := Length(AString) + 1;
for cnt := posini to Length(AString) do
begin
  if AString[cnt] in SepChars then <= changed
  begin
posend := cnt;
Break;
  end;
end;

if (posend - posini) > 0 then
  ResList.Add(Trim(Copy(AString, posini, posend - posini)));

posini := posend + 1;
  end;
end;

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TProxyInfo from User Made page

2007-07-27 Thread Arno Garrels
Maurizio Lotauro wrote:
> Scrive Arno Garrels <[EMAIL PROTECTED]>:
> 
>> Hello Maurizio,
> 
> Hello Arno,
> 
>> TProxyInfo does not parse the proxy-strings correctly
>> since here in W2K entries are separated by a space, I changed
>> below function to accept multiple separator chars.
>> Now when I pass separators [';', ' '] the component works fine.
> 
> [...]
> 
> Do you pass two separators in all three calls of SplitString()?

Yes.

> Is it possible that the separator depends on ListSeparator (set in
> Control Panel)?

No since it _is set to ";".
After some investigation, the bug seems to be in function IE_WinInet.
The first call of InternetQueryOption() returns the correct, semicolon
separated list in optlst.pOptions^[1].pszValue, however since the result
is not properly set to TRUE (Result := FScriptLoaded ?, I don't use a script)
InternetQueryOption()is called again with a different option set
which returns the space-separated list in prinfo^.lpszProxy. 
WININET.DLL is version 6.0.2800.1511 and returns all info needed at
the first call.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TWSocket for .Net and C#?

2007-08-06 Thread Arno Garrels
Fredrik Larsson wrote:
> I don't see it. I guess you found how to delete it yourself.
> 
> The link is
> http://wiki.overbyte.be/wiki/index.php/FAQ.Microsoft.NET_framework

I saw it a couple of hours back, now the above link doesn't work for
me (There is currently no text in this page). 

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

 

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


Re: [twsocket] TProxyInfo from User Made page

2007-08-13 Thread Arno Garrels
Maurizio Lotauro wrote:
> Scrive Arno Garrels <[EMAIL PROTECTED]>:
> 
> Hello Arno,
> 
> I finally got some time to examine the problem :-)

Thanks.

> Now I'll change the code. Do you mind I'll send you a copy to test
> it? :-) 

OK, drop me a private mail.

> 
> Revising the code I noticed this in the API description. For the
> InternetGetProxyInfo function for the lplpszProxyHostName say:
> "[out] A pointer to the address of a buffer that receives the URL of
> the proxy to use in an HTTP request for the specified resource. The
> application is responsible for freeing this string."
> How I should free the string?

Don't you allocate the memory before passing the pointer?

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

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


Re: [twsocket] TProxyInfo from User Made page

2007-08-13 Thread Arno Garrels
Maurizio Lotauro wrote:
> Scrive Arno Garrels <[EMAIL PROTECTED]>:
> 
>> Maurizio Lotauro wrote:
>>> Scrive Arno Garrels <[EMAIL PROTECTED]>:
> 
> [...]
> 
>>> Revising the code I noticed this in the API description. For the
>>> InternetGetProxyInfo function for the lplpszProxyHostName say:
>>> "[out] A pointer to the address of a buffer that receives the URL of
>>> the proxy to use in an HTTP request for the specified resource. The
>>> application is responsible for freeing this string."
>>> How I should free the string?
>> 
>> Don't you allocate the memory before passing the pointer?
> 
> No, should I? The docs don't seems very clear to me. Have look at

I think you should, like with most DLL calls that return a variable
amount of data. There's also lpdwProxyHostNameLength. Mostly when you
call such functions with a nil pointer and/or zero length 
the function will return the length of the buffer that the caller
has to allocate before calling it a second time with
a non-nil pointer to an allocated piece of memory. Is this
not working you?

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

> http://msdn2.microsoft.com/en-us/library/aa384726.aspx
> 
> 
> Bye, Maurizio.
> 
> 
> 
> This mail has been sent using Alpikom webmail system
> http://www.alpikom.it
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TProxyInfo from User Made page

2007-08-14 Thread Arno Garrels
Maurizio Lotauro wrote:
> No. I redo the test based on the sample found in the following link:
> 
> http://msdn2.microsoft.com/en-us/library/aa383910.aspx

As you already wrote, in the sample they pass a pointer to an
allocated buffer that is never been used :-) 
Seems to be an incorrect example.

So Gunnar is right. In my test below GlobalFree() doesn't
return an error.

procedure TForm1.Button1Click(Sender: TObject);
type
PAutoProxyScriptBuffer = ^AUTO_PROXY_SCRIPT_BUFFER;
AUTO_PROXY_SCRIPT_BUFFER = packed record
  dwStructSize: DWORD;
  lpszScriptBuffer: LPSTR;
  dwScriptBufferSize: DWORD;
end;
TAutoProxyScriptBuffer = AUTO_PROXY_SCRIPT_BUFFER;

const
f_InternetGetProxyInfo : function(
  Url : PChar; UrlLength: DWORD;
  UrlHostName : PChar; UrlHostNameLength : DWORD;
  var ProxyHostName : PChar;  var ProxyHostNameLength : DWORD
  ): Boolean; stdcall = nil;
f_InternetInitializeAutoProxyDll : function (
   Version : DWORD; DownloadedTempFile : PChar;
   Mime : PChar; AutoProxyCallbacks: Pointer;
   AutoProxyScriptBuffer: PAutoProxyScriptBuffer
   ): Boolean; stdcall = nil;
f_InternetDeInitializeAutoProxyDll : function (
 lpszMime: LPSTR; dwReserved: DWORD
 ): Boolean; stdcall = nil;
var
hLib: THandle;
Url : String;
UrlHostName : String;
ProxyHostName : PChar;
ProxyHostNameLength : DWord;
scrbuf: TAutoProxyScriptBuffer;
PacFile : String;
begin
PacFile := 'function FindProxyForURL(url, host)'#13#10 +
   '{'#13#10 +
   '  return "PROXY 192.168.178.201:8080";'#13#10 +
   '}'#0;

hLib := LoadLibrary('jsproxy.dll');
if hLib = 0 then
RaiseLastOSError;
try
f_InternetGetProxyInfo := GetProcAddress(hLib, 'InternetGetProxyInfo');
if not Assigned(f_InternetGetProxyInfo) then
raise Exception.Create('f_InternetGetProxyInfo not assigned');
f_InternetInitializeAutoProxyDll := GetProcAddress(hLib, 
'InternetInitializeAutoProxyDll');
if not Assigned(f_InternetInitializeAutoProxyDll) then
raise Exception.Create('f_InternetInitializeAutoProxyDll not 
assigned');
f_InternetDeInitializeAutoProxyDll := GetProcAddress(hLib, 
'InternetDeInitializeAutoProxyDll');
if not Assigned(f_InternetDeInitializeAutoProxyDll) then
raise Exception.Create('f_InternetDeInitializeAutoProxyDll not 
assigned');

scrbuf.dwStructSize := SizeOf(TAutoProxyScriptBuffer);
scrbuf.lpszScriptBuffer := @PACFile[1];
scrbuf.dwScriptBufferSize := Length(PacFile);
if not f_InternetInitializeAutoProxyDll(0, nil, nil, nil, @scrbuf) then
RaiseLastOSError;
try
Url := 'http://www.domain.com/index.html';
UrlHostName := 'www.domain.com';

if not f_InternetGetProxyInfo(
   PChar(Url), Length(Url) + 1,
   PChar(UrlHostName), Length(UrlHostName) + 1,
   ProxyHostName, ProxyHostNameLength) then
RaiseLastOSError;
ShowMessage(ProxyHostName);
GlobalFree(Cardinal(ProxyHostName));
finally
f_InternetDeInitializeAutoProxyDll(nil, 0);
end;
finally
FreeLibrary(hLib);
end;
end; 

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


Re: [twsocket] FTP server no timeout

2007-08-16 Thread Arno Garrels
Angus Robertson - Magenta Systems Ltd wrote:
> It seems strange Windows (only XP on this particular server) does not
> timeout the TCP/IP with no keep alives, or is this something I have to
> set?
> Otherwise the FTP server really needs a time out for each
> client, triggered from a timer.

I won't use keep alives in the FTP server but a client timeout triggered
by a single timer. Lengthy transfers on the data channel should not
trigger a timeout of the control channel, like many FTP servers do.

Arno Garrels


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


Re: [twsocket] What would cause an ICS-threaded server to run into 100%CPU usage?

2007-08-17 Thread Arno Garrels
Fastream Technologies wrote:
> Yes, this is the question. It only happens at customer site and I
> cannot do remote debugging since the connection is not that fast.

Under heavy load ?

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] What would cause an ICS-threaded servertoruninto100%CPU usage?

2007-08-17 Thread Arno Garrels
Fastream Technologies wrote:
> Hello,
> 
> They have everything right in terms of hardware--3GB RAM, 100Mbps
> Ethernet. 
> It works for 3 hours but then something strange goes crazy. I wonder
> what 
> kind of error would cause this...

May be Windows is paging to disk, have you looked at virtual memory
use in taskmanager yet ?
Or may be some infinite loop somewhere in your code ?

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html 

> 
> Regards,
> 
> SZ
> 
> - Original Message -
> From: "Fredrik Larsson" <[EMAIL PROTECTED]>
> To: "'ICS support mailing'" 
> Sent: Friday, August 17, 2007 7:27 PM
> Subject: Re: [twsocket] What would cause an ICS-threaded server
> toruninto100%CPU usage?
> 
> 
> What processor do they have and how much memory do they have? Do they
> have a 
> 100 mbit network card or just a 10 mbit? Might be older one that
> clogs the 
> processor more?
> 
> Regards, Fredrik.
> 
> -Ursprungligt meddelande-
> Från: [EMAIL PROTECTED] [mailto:twsocket-
> [EMAIL PROTECTED] För 
> Fastream Technologies
> Skickat: den 17 augusti 2007 17:50
> Till: ICS support mailing
> Ämne: Re: [twsocket] What would cause an ICS-threaded server to
> runinto100%CPU usage?
> 
> I said yes but do not get me wrong, when run at 100Mbps (which is
> _more_ 
> than the case), it normally consumes 10% CPU!!
> 
> --
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Help with re-install simply WSocket?

2007-08-19 Thread Arno Garrels
TK Boyd wrote:
> 
> "Cannot assign to read only property"
> 
> ... when it hits
> 
> FLogFile.Size:=0
> 
> ... in ICSLogger.

Yes, seems to be read only in D2, since D3 Size is read/write.
Eather try to change this line to FLogFile.Position := 0 (not 
sure whether that would work the same)
or define  NO_DEBUG_LOG  in the project options to exclude 
the IcsLogger component.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] OT: Ping: Arno Garrels

2007-08-20 Thread Arno Garrels
Fastream Technologies wrote:
> Hello Arno,
> 
> Are you getting the emails I send? Please let me know from this email.

I'm currently very busy thus cannot answer private support requests.
Please ask those questions in an appropriate newsgroups or mailing list.

Thanks,

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Fw: Can one get the home folder of an user fromActiveDirectory?

2007-08-20 Thread Arno Garrels
Fastream Technologies wrote:
>> Which home folder should each FTP user show? In the demo they all
>> show the same folder but that's not a real-life scenario!

Although this is common Windows-programming stuff and slightly OT:
Usually the server-admin configures user's home directories.
Have a look at the GetSpecialFolderLocation() API, if that is what
you are after.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Fw: Can one get the home folder of an userfromActiveDirectory?

2007-08-20 Thread Arno Garrels
Correction I meant the SHGetSpecialFolderLocation() API.

Arno Garrels wrote:
> Fastream Technologies wrote:
>>> Which home folder should each FTP user show? In the demo they all
>>> show the same folder but that's not a real-life scenario!
> 
> Although this is common Windows-programming stuff and slightly OT:
> Usually the server-admin configures user's home directories.
> Have a look at the GetSpecialFolderLocation() API, if that is what
> you are after.
> 
> --
> Arno Garrels [TeamICS]
> http://www.overbyte.be/eng/overbyte/teamics.html
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Fw: Can one get the home folder ofanuserfromActiveDirectory?

2007-08-21 Thread Arno Garrels
Fastream Technologies wrote:
> I do not think you see my point at all... I do NOT want to get the
> home folder of the service account user's. I need to input the
> username from the USER command in TO the ActiveDirectory.

What means "input the user name in To the ActiveDirectory"?

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Fw: Can one get the homefolderofanuserfromActiveDirectory?

2007-08-21 Thread Arno Garrels
Fastream Technologies wrote:
> I need to query the username's (as gotten from USER command) home
> folder 
>> from AD.

Have you already tried SHGetSpecialFolderLocation() after LogonUser()
ImpersonateLoggedOnUser()? 

If that doesn't work have a look at the User and Group functions 
among the Network Management Functions:
http://msdn2.microsoft.com/en-us/library/aa370675.aspx

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html


> 
> Clear?
> 
> Best Regards,
> 
> Sz
> 
> - Original Message -
> From: "Arno Garrels" <[EMAIL PROTECTED]>
> To: "ICS support mailing" 
> Sent: Tuesday, August 21, 2007 1:02 PM
> Subject: Re: [twsocket] Fw: Can one get the home
> folderofanuserfromActiveDirectory?
> 
> 
>> Fastream Technologies wrote:
>>> I do not think you see my point at all... I do NOT want to get the
>>> home folder of the service account user's. I need to input the
>>> username from the USER command in TO the ActiveDirectory.
>> 
>> What means "input the user name in To the ActiveDirectory"?
>> 
>> --
>> Arno Garrels [TeamICS]
>> http://www.overbyte.be/eng/overbyte/teamics.html
>> --
>> To unsubscribe or change your settings for TWSocket mailing list
>> please goto http://www.elists.org/mailman/listinfo/twsocket
>> Visit our website at http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] ThreadDEtach with THttpConnection problem

2007-08-22 Thread Arno Garrels
Francois Piette wrote:
>> In triggersessionclosed, I postthreadmessage to a message handler in
>> the same worker thread which then thread-detaches and posts the
>> object to listener thread. However, in every 1-2 hours, under heavy
>> load, the worker thread gives an AV which I suspect is due to a
>> recv/send callback event being launched after threaddetach. How can
>> I prevent this? 
> 
> If you had looked at the source code, you could have seen that when
> ThreadDetach is called, the socket is asked to stop sending
> notifications (WSAASyncSelect is called with nul mask) and the hidden
> window is cancelled. So technically speaking, no notification can
> take place before you attach the socket again to a thread in which
> case a new hidden window is assigned and WSAASyncSelect called to
> request notifications from winsock. 
> 
> In ICS-V6, the hidden window is shared by several components.
> ThreadDetach unregister the messages which where used by the
> component. 

Even if there were still such unregistered messages pending in the message
queue due to the hidden window still exists (handling messages for other
components of that thread) those unregistered messages won't be touched
by the component but handled by DefWindowProc, so no problem. If the
hidden window has been destroyed Windows flushes the thread message
queue so GetMessage() should never see a message for a non-existing
window.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] ThreadDEtach with THttpConnection problem

2007-08-22 Thread Arno Garrels
Fastream Technologies wrote:
>> Even if there were still such unregistered messages pending in the
>> message queue due to the hidden window still exists (handling
>> messages for other components of that thread) those unregistered
>> messages won't be touched by the component but handled by
>> DefWindowProc, so no problem. If the hidden window has been
>> destroyed Windows flushes the thread message queue so GetMessage()
>> should never see a message for a non-existing window.
> 
> How does DefWindowProc work? 

In this cases it removes those unregistered messages from the
queue, note that in this case the window still exists.

> What if the handle posted is no longer
> in that thread? 

I think that's impossible, since GetMessage() or PeekMessage() won't retrieve
messages with an invalid window handle.

Your message pump may not work correctly, make sure that you
use this template:
 
while GetMessage(Msg, 0, 0, 0) do
begin
if (Msg.hwnd = 0) then //***
begin
**handle thread messages here (those posted by PostThreadMessage)** 
   
end
else begin 
TranslateMessage(Msg);
DispatchMessage(Msg);
end;
end;

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] ThreadDEtach with THttpConnection problem

2007-08-22 Thread Arno Garrels
Fastream Technologies wrote:
> Is TranslateMessage really needed in a socket worker thread?

I guess it's not needed, however I use it in all of my pumps.

> All I know is I see 
> "EAccessViolation" at DispatchMessage() of worker thread.

The debugger isn't very reliable in multi-threaded applications
it happens that it stops at one line whilst the error is at a different
location.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

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


Re: [twsocket] ThreadDEtach with THttpConnection problem

2007-08-22 Thread Arno Garrels
Fastream Technologies wrote:
> But it always stops at that dispatchmessage! Persistent and insistent.

Now that I have some minutes, I checked the source code again,
however I cannot find any bug, may be sorting out things helps a bit?

When a window is being destroyed all pending messages in thread's
message queue addressed to the destroyed window are being removed
as well. I just wrote a little test project that confirms the API doku.
So it seems impossible that GetMessage/PeekMessage will ever retrieve
messages to an already destroyed window.

Since winsock does not try to send any further notification messages
to the destroyed window (as Francois already mentioned) this can be
sorted out as well.

Remains the case when the window is not being destroyed, but registered 
message numbers have been unregistered. Means there may be still messages
pending in thread's message queue addressed to an existing window, however
they won't be handled by the component but passed to DefWindowProc which
will throw them away.

Do you register new custom messages, thru AllocateMsgHandlers? If so   
are they unregistered properly by overriding FreeMsgHandlers as well?

Also critical: When the component has no window handle and for some
reason property Handle is called an auto-attach is performed by the 
component which _must_ be avoided. 

Remains the question whether important messages may be removed upon the
call to ThreadDetach()? I don't think so, given that it's called after 
SessionClosed, though the message pump may be called from InternalClose,
however that should not hurt at all. 

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

> 
> On 8/22/07, Arno Garrels <[EMAIL PROTECTED]> wrote:
>> 
>> Fastream Technologies wrote:
>>> Is TranslateMessage really needed in a socket worker thread?
>> 
>> I guess it's not needed, however I use it in all of my pumps.
>> 
>>> All I know is I see
>>> "EAccessViolation" at DispatchMessage() of worker thread.
>> 
>> The debugger isn't very reliable in multi-threaded applications
>> it happens that it stops at one line whilst the error is at a
>> different location.
>> 
>> --
>> Arno Garrels [TeamICS]
>> http://www.overbyte.be/eng/overbyte/teamics.html
>> 
>> --
>> To unsubscribe or change your settings for TWSocket mailing list
>> please goto http://www.elists.org/mailman/listinfo/twsocket
>> Visit our website at http://www.overbyte.be
>> 
> 
> 
> 
> --
> CSA, Fastream Technologies
> Software IQ: Innovation & Quality
> www.fastream.com | Email: [EMAIL PROTECTED] | Tel: +90-312-223-2830
> Join IQWF Server Yahoo group at
> http://groups.yahoo.com/group/IQWFServer Join IQ Reverse Proxy Yahoo
> group at http://groups.yahoo.com/group/IQReverseProxy
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Is this design correct for THttpConnection/THttpClireturn to pool?

2007-08-27 Thread Arno Garrels
I don't see anything wrong, however read my comments inline.

Fastream Technologies wrote:
> void __fastcall ReverseProxyClientClass::WaitForHTTPClientAbort(void)
> {
>  abortingHTTPClient = true;
>  HTTPClient->abortComplete = false;
>  HTTPClient->OnRequestDone = HTTPClientRequestDoneAfterAbort;
>  HTTPClient->Abort();
> 
>  if(!HTTPClient->abortComplete)
>  {
>   bool pausedHere = false;
>   if(!Paused)
>   {
>Pause();

If you pause THttpCli's underlaying socket it's most likely
not required however I don't think it hurts.

>pausedHere = true;
>   }
> 
>   MSG msg;
>   while(!HTTPClient->abortComplete)
>if(GetMessage(&msg, NULL, 0, 0))
> affinityThread->processServerThreadMessage(msg);
>else
>  break;

It's unfortunately needed to pump messages since THttpCli.Abort
may not block (RequestDone may be triggered delayed by a posted message),
which I think should/can be easily changed to _always behave blocking.
THttpCli.Abort also may call FCtrlSocket.Close.
I don't understand why it doesn't always call FCtrlSocket.Abort,
which would make sure that TWSocket.InternalClose() finished as
soon as possible? 

Arno Garrels

 
>   if(!FSessionClosedFlag && pausedHere)
>Resume();
>  }
> 
>  abortingHTTPClient = false;
>  HTTPClient->working = false;
>  HTTPClient->abortNextTime = false;
>  HTTPClient->OnRequestDone = NULL;
> }
> //
> --- void __fastcall
> ReverseProxyClientClass::HTTPClientRequestDoneAfterAbort(TObject
> *Sender, THttpRequest RqType, WORD ErrCode)
> {
>  HTTPClient->abortComplete = true;
> }
> //
> --- 
> 
>> from return-to-pool function in worker/client thread. There are
>> definable 
> number of clients per thread. The message pump is as Arno previously
> suggested. This code now works fine for 7-12 hours then crashes. Of
> course I won't bog you with thousands of lines of code but perhaps
> you could tell me if the above sync logic is cool (or not).
> 
> Best Regards,
> 
> SZ
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Is there any code example for sending emails throughGMail with ICS?

2007-08-31 Thread Arno Garrels
This may be a stupid question, isn't GMAIL = Google Mail 
and doesn't it allow sending thru their webmail client only?

Fastream Technologies wrote:
> TIA,
> 
> SZ
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Is there any code example for sendingemailsthroughGMail with ICS?

2007-08-31 Thread Arno Garrels
Fastream Technologies wrote:
> No, I use their POP/SMTP service with Windows Mail. It requires SSL.

Then try ICS-SSL and the TSslSmtpCli component, it supports the StartTls
command.

Arno Garrels

> 
> Best Regards,
> 
> Gorkem Ates
> Fastream Technologies
> Software IQ: Innovation & Quality
> www.fastream.com | Email: [EMAIL PROTECTED] | Tel: +90-312-223-2830
> Join IQWF Server Yahoo group at
> http://groups.yahoo.com/group/IQWFServer Join IQ Reverse Proxy Yahoo
> group at http://groups.yahoo.com/group/IQReverseProxy
> 
> - Original Message -
> From: "Arno Garrels" <[EMAIL PROTECTED]>
> To: "ICS support mailing" 
> Sent: Friday, August 31, 2007 10:41 AM
> Subject: Re: [twsocket] Is there any code example for sending
> emailsthroughGMail with ICS?
> 
> 
>> This may be a stupid question, isn't GMAIL = Google Mail
>> and doesn't it allow sending thru their webmail client only?
>> 
>> Fastream Technologies wrote:
>>> TIA,
>>> 
>>> SZ
>> --
>> To unsubscribe or change your settings for TWSocket mailing list
>> please goto http://www.elists.org/mailman/listinfo/twsocket
>> Visit our website at http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Is there any code exampleforsendingemailsthroughGMail with ICS?

2007-08-31 Thread Arno Garrels
Dave Baxter wrote:
> Be aware though, that only the initial connection authentication is
> secured with TLS/SSL, the POP and SMTP transfers are I am told not
> secured.

Switching back to plain text is not yet supported by TSslSmtpCli, only
the SSL-FTP client supports it. That's probably very easy to add to the
SMTP client as well.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

> 
> Even so, it's very useful to have a POP/SMTP service you can use
> reliably from any PC, anywhere, with a simple client on a USB stick
> for example.
> 
> Dave B.
> 
>> -----Original Message-
>> From: Arno Garrels [mailto:[EMAIL PROTECTED]
>> Sent: Friday, August 31, 2007 9:03 AM
>> To: ICS support mailing
>> Subject: Re: [twsocket] Is there any code example
>> forsendingemailsthroughGMail with ICS?
>> 
>> Fastream Technologies wrote:
>>> No, I use their POP/SMTP service with Windows Mail. It requires SSL.
>> 
>> Then try ICS-SSL and the TSslSmtpCli component, it supports
>> the StartTls command.
>> 
>> Arno Garrels
>> 
>>> 
>>> Best Regards,
>>> 
>>> Gorkem Ates
>>> Fastream Technologies
>>> Software IQ: Innovation & Quality
>>> www.fastream.com | Email: [EMAIL PROTECTED] | Tel: +90-312-223-
>>> 2830 Join IQWF Server Yahoo group at
>>> http://groups.yahoo.com/group/IQWFServer Join IQ Reverse Proxy Yahoo
>>> group at http://groups.yahoo.com/group/IQReverseProxy
>>> 
>>> - Original Message -
>>> From: "Arno Garrels" <[EMAIL PROTECTED]>
>>> To: "ICS support mailing" 
>>> Sent: Friday, August 31, 2007 10:41 AM
>>> Subject: Re: [twsocket] Is there any code example for sending
>>> emailsthroughGMail with ICS?
>>> 
>>> 
>>>> This may be a stupid question, isn't GMAIL = Google Mail and
>>>> doesn't it allow sending thru their webmail client only?
>>>> 
>>>> Fastream Technologies wrote:
>>>>> TIA,
>>>>> 
>>>>> SZ
>>>> --
>>>> To unsubscribe or change your settings for TWSocket mailing list
>>>> please goto http://www.elists.org/mailman/listinfo/twsocket
>>>> Visit our website at http://www.overbyte.be
>> 
>> 
> This mail has been scanned by Palmer Cook Computer Services Limited. 
> www.palmercook.co.uk 
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Question regarding ActiveDirectory in FTP for Arno

2007-08-31 Thread Arno Garrels
Fastream Technologies wrote:
> Helo Arno,
> 
> I wonder how would one determine the permission field for FTP
> directory listings. For example:
> 
> drwxrwxrwx 
> 
> This may not be needed for the demo yet definitely required for a real
> server. SurgeFTP does this but it's not open source. FileZilla has no
> AD support.

I doubt that SurgeFTP realy writes permissions on a Windows box.
Setting NTFS rights is no problem _if_ somebody knows how to translate
the UNIX access mask into a Windows mask?   

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Question regarding ActiveDirectory in FTP for Arno

2007-09-01 Thread Arno Garrels
Fastream Technologies wrote:
> Arno,
> 
> I think you misunderstood. For each folder listing record (file or
> folder in Windows, plus links in UNIX) in FTP, the FTP server GETs
> the permissions 
>> from the system for display purposes. This is not for CHMOD setting,
>> this is 
> for folder listings.

Anyway,  

> 
> Please tell me how will I get the read/write/execute permissions from
> the AD for each folder without attempting each operation. There must
> be a practical way!

I use these Windows API functions:
GetNamedSecurityInfo()
MapGenericMask()
AccessCheck()

Anyway, I don't know how to translate the resulting mask to unix format,
also there's no reliable way to get the effective rights of users without
having the user access token, even XP shows sometimes nonsense effektive
rights of not logged on users.  

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html


> 
> Regards,
> 
> SZ
> 
> - Original Message -
> From: "Arno Garrels" <[EMAIL PROTECTED]>
> To: "ICS support mailing" 
> Sent: Friday, August 31, 2007 5:56 PM
> Subject: Re: [twsocket] Question regarding ActiveDirectory in FTP for
> Arno 
> 
> 
>> Fastream Technologies wrote:
>>> Helo Arno,
>>> 
>>> I wonder how would one determine the permission field for FTP
>>> directory listings. For example:
>>> 
>>> drwxrwxrwx 
>>> 
>>> This may not be needed for the demo yet definitely required for a
>>> real server. SurgeFTP does this but it's not open source. FileZilla
>>> has no AD support.
>> 
>> I doubt that SurgeFTP realy writes permissions on a Windows box.
>> Setting NTFS rights is no problem _if_ somebody knows how to
>> translate the UNIX access mask into a Windows mask?
>> 
>> --
>> Arno Garrels [TeamICS]
>> http://www.overbyte.be/eng/overbyte/teamics.html
>> --
>> To unsubscribe or change your settings for TWSocket mailing list
>> please goto http://www.elists.org/mailman/listinfo/twsocket
>> Visit our website at http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Question regarding ActiveDirectory in FTP for Arno

2007-09-01 Thread Arno Garrels
Arno Garrels wrote:
> I use these Windows API functions:
> GetNamedSecurityInfo()
> MapGenericMask()
> AccessCheck()
> 
> Anyway, I don't know how to translate the resulting mask to unix
> format, also there's no reliable way to get the effective rights of
> users without having the user access token, even XP shows sometimes
> nonsense effektive rights of not logged on users.

Btw: If you want to see the above functions in action get this small
demo binary from here : http://www.duodata.de/misc/delphi/ChkAcc.zip
And then tell us your idea how to form the UNIX mask from it, that
includes three parts for Owner, Group and Public.

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


Re: [twsocket] Question regarding ActiveDirectory in FTP for Arno

2007-09-01 Thread Arno Garrels
Fastream Technologies wrote:
> BTW, I see that this demo cannot get permissions for folders (only
> files). Is there a special reason for this?

It works with directories as well, of course. And with a few changes
with all Securable Objects. I uploaded the source code here:
http://www.duodata.de/misc/delphi/ChkAcc.zip
But hav not checked BCB compatibility, though I think it should
work with BCB as well.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html


> 
> Regards,
> 
> SZ
> 
> - Original Message -----
> From: "Arno Garrels" <[EMAIL PROTECTED]>
> To: "ICS support mailing" 
> Sent: Saturday, September 01, 2007 1:32 PM
> Subject: Re: [twsocket] Question regarding ActiveDirectory in FTP for
> Arno 
> 
> 
>> Arno Garrels wrote:
>>> I use these Windows API functions:
>>> GetNamedSecurityInfo()
>>> MapGenericMask()
>>> AccessCheck()
>>> 
>>> Anyway, I don't know how to translate the resulting mask to unix
>>> format, also there's no reliable way to get the effective rights of
>>> users without having the user access token, even XP shows sometimes
>>> nonsense effektive rights of not logged on users.
>> 
>> Btw: If you want to see the above functions in action get this small
>> demo binary from here : http://www.duodata.de/misc/delphi/ChkAcc.zip
>> And then tell us your idea how to form the UNIX mask from it, that
>> includes three parts for Owner, Group and Public.
>> 
>> Arno Garrels
>> --
>> To unsubscribe or change your settings for TWSocket mailing list
>> please goto http://www.elists.org/mailman/listinfo/twsocket
>> Visit our website at http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] RAD Studio 2007 seems to out

2007-09-05 Thread Arno Garrels
http://www.codegear.com

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Ftp-file corruption check

2007-09-16 Thread Arno Garrels
New Era wrote:
> How to check if a file is either uploaded correctly or not, I know
> that ftpCli supports MD5 command, but at the outside world there were
> no commercial ftp hosting services that support MD5 command, I only
> found one ftp hosting which supports XCRC and this is command as far
> as I know, is not supported by ftpCli. (I am trying to build an ftp
> client that is to be used to upload files to external ftp host.)

Aug 06, 2006 V2.107 Angus [SNIP]
 added XCRC command to get CRC32 for file (for servers without MD5)

So get latest ICS-Beta, it's in both V5 and V6

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html 
 
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] FTP Server demo fails

2007-09-19 Thread Arno Garrels
Francois PIETTE wrote:
>> Any ideas what's causing this?
> 
> No idea.

I'm also not able to reproduce this in V6 D2007, strange.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

> 
>> I'm unable to trace into the Pascal source for some reason.
> 
> Add the component source code to your application project. You'll be
> able to 
> débug.
> 
> --
> [EMAIL PROTECTED]
> The author of the freeware multi-tier middleware MidWare
> The author of the freeware Internet Component Suite (ICS)
> http://www.overbyte.be
> 
> 
> - Original Message -
> From: "David Perkins" <[EMAIL PROTECTED]>
> To: 
> Sent: Wednesday, September 19, 2007 4:24 PM
> Subject: [twsocket] FTP Server demo fails
> 
> 
>> Hello
>> 
>> I'm using the latest ICS and BCB2006 to test the ftp server demo.
>> When attempting to connect to the server from another PC using
>> filezilla it throws an exception in the OnAuthenticate event.  I've
>> narrowed it down and here is what makes it go pop:
>> 
>> void __fastcall TFtpServerForm::FtpServer1Authenticate(TObject
>> *Sender,  TFtpCtrlSocket *Client, TFtpString &UserName,
>> TFtpString &Password,  bool &Authenticated)
>> {
>>  String s = UserName;   <- Bang!
>> 
>> 
>> I'm unable to trace into the Pascal source for some reason.
>> 
>> I'm connecting using passive mode.  FTP component property values
>> are: 
>> 
>> object FtpServer1: TFtpServer
>>Addr = '0.0.0.0'
>>Port = '10021'
>>Banner = '220 ICS FTP Server ready'
>>UserData = 0
>>MaxClients = 50
>>PasvIpAddr = '192.168.1.10'
>>PasvPortRangeStart = 10050
>>PasvPortRangeSize = 50
>>Options = []
>> 
>> 
>> Any ideas what's causing this?
>> 
>> Thanks
>> 
>> David
>> --
>> To unsubscribe or change your settings for TWSocket mailing list
>> please goto http://www.elists.org/mailman/listinfo/twsocket
>> Visit our website at http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] FTP Server demo fails

2007-09-20 Thread Arno Garrels
David Perkins wrote:

> 1.  I plan on using the FTP server in a Service app with no main form.
> Does the FTP Server rely on Windows messages at all for it's
> processing?

Yes, like any other ICS component as well. Note that the ICS components
create one or more hidden windows in order to receive event messages
from winsock. ICS events will always trigger in the context of the thread
where the components have been created. If you create the component in
TThread.OnStart or TThread.OnExecute the events will fire in the context
of the service thread which was fine. Define NOFORMS in the project options
in order to get these windows created in a thread-safe manner. 
Usually running ICS in a worker thread requires a working message pump,
that's not necessary in the service thread of TThread since there is
one already pumping messages (ProcessRequests). 

> 
> 2. Are the events; OnValid called from the context of the main
> process or a background thread?

By default ICS doesn't create threads, see above. 

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

> 
> Many thanks.
> 
> David
> 
> 
> 
> On 19/09/2007, Arno Garrels <[EMAIL PROTECTED]> wrote:
>> Francois PIETTE wrote:
>>>> Any ideas what's causing this?
>>> 
>>> No idea.
>> 
>> I'm also not able to reproduce this in V6 D2007, strange.
>> 
>> --
>> Arno Garrels [TeamICS]
>> http://www.overbyte.be/eng/overbyte/teamics.html
>> 
>>> 
>>>> I'm unable to trace into the Pascal source for some reason.
>>> 
>>> Add the component source code to your application project. You'll be
>>> able to
>>> débug.
>>> 
>>> --
>>> [EMAIL PROTECTED]
>>> The author of the freeware multi-tier middleware MidWare
>>> The author of the freeware Internet Component Suite (ICS)
>>> http://www.overbyte.be
>>> 
>>> 
>>> - Original Message -
>>> From: "David Perkins" <[EMAIL PROTECTED]>
>>> To: 
>>> Sent: Wednesday, September 19, 2007 4:24 PM
>>> Subject: [twsocket] FTP Server demo fails
>>> 
>>> 
>>>> Hello
>>>> 
>>>> I'm using the latest ICS and BCB2006 to test the ftp server demo.
>>>> When attempting to connect to the server from another PC using
>>>> filezilla it throws an exception in the OnAuthenticate event.  I've
>>>> narrowed it down and here is what makes it go pop:
>>>> 
>>>> void __fastcall TFtpServerForm::FtpServer1Authenticate(TObject
>>>> *Sender,  TFtpCtrlSocket *Client, TFtpString &UserName,
>>>> TFtpString &Password,  bool &Authenticated)
>>>> {
>>>>  String s = UserName;   <- Bang!
>>>> 
>>>> 
>>>> I'm unable to trace into the Pascal source for some reason.
>>>> 
>>>> I'm connecting using passive mode.  FTP component property values
>>>> are:
>>>> 
>>>> object FtpServer1: TFtpServer
>>>>Addr = '0.0.0.0'
>>>>Port = '10021'
>>>>Banner = '220 ICS FTP Server ready'
>>>>UserData = 0
>>>>MaxClients = 50
>>>>PasvIpAddr = '192.168.1.10'
>>>>PasvPortRangeStart = 10050
>>>>PasvPortRangeSize = 50
>>>>Options = []
>>>> 
>>>> 
>>>> Any ideas what's causing this?
>>>> 
>>>> Thanks
>>>> 
>>>> David
>>>> --
>>>> To unsubscribe or change your settings for TWSocket mailing list
>>>> please goto http://www.elists.org/mailman/listinfo/twsocket
>>>> Visit our website at http://www.overbyte.be
>> --
>> To unsubscribe or change your settings for TWSocket mailing list
>> please goto http://www.elists.org/mailman/listinfo/twsocket
>> Visit our website at http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] FTP Server demo fails

2007-09-20 Thread Arno Garrels
David Perkins wrote:
> Thanks for that Arno.
> 
> OK, I will compile ICS with NOFORMS defined, I presume that's where it
> goes rather that being defined in my app.

In Delphi it's defined in the project options, I'm not very familar with
BCB, sorry. 

> 
> Since this is going to go in a thread within a service app, I had
> intended to create my thread, create and start the ftp server and then
> block (WaitForMultipleObjects) until the FTP server reports that new
> files have arrived.  From what you say, this won't work as I'll be
> blocking the FTP Server.

Correct, that won't work of course. In your ThreadProc create the component
and call GetMessage(), TranslateMessage() and DispatchMessage in a loop. 
Anything else can either be done from the ICS events, or from handlers of
custom messages posted to Thread, i.e. to stop or start the server etc.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

> 
> I use my own thread class, rather than the VCL Thread class and when
> executing I just sit inside a while/WaitForMultipleObjects loop until
> the terminate event is received.  If I create an FTP Server in this
> thread, what would I have to call to get the FTP Server to process any
> requests?
> 
> Many thanks.
> 
> 
> On 20/09/2007, Arno Garrels <[EMAIL PROTECTED]> wrote:
>> David Perkins wrote:
>> 
>>> 1.  I plan on using the FTP server in a Service app with no main
>>> form. Does the FTP Server rely on Windows messages at all for it's
>>> processing?
>> 
>> Yes, like any other ICS component as well. Note that the ICS
>> components create one or more hidden windows in order to receive
>> event messages from winsock. ICS events will always trigger in the
>> context of the thread where the components have been created. If you
>> create the component in TThread.OnStart or TThread.OnExecute the
>> events will fire in the context of the service thread which was
>> fine. Define NOFORMS in the project options in order to get these
>> windows created in a thread-safe manner. Usually running ICS in a
>> worker thread requires a working message pump, that's not necessary
>> in the service thread of TThread since there is one already pumping
>> messages (ProcessRequests). 
>> 
>>> 
>>> 2. Are the events; OnValid called from the context of the main
>>> process or a background thread?
>> 
>> By default ICS doesn't create threads, see above.
>> 
>> --
>> Arno Garrels [TeamICS]
>> http://www.overbyte.be/eng/overbyte/teamics.html
>> 
>>> 
>>> Many thanks.
>>> 
>>> David
>>> 
>>> 
>>> 
>>> On 19/09/2007, Arno Garrels <[EMAIL PROTECTED]> wrote:
>>>> Francois PIETTE wrote:
>>>>>> Any ideas what's causing this?
>>>>> 
>>>>> No idea.
>>>> 
>>>> I'm also not able to reproduce this in V6 D2007, strange.
>>>> 
>>>> --
>>>> Arno Garrels [TeamICS]
>>>> http://www.overbyte.be/eng/overbyte/teamics.html
>>>> 
>>>>> 
>>>>>> I'm unable to trace into the Pascal source for some reason.
>>>>> 
>>>>> Add the component source code to your application project. You'll
>>>>> be able to
>>>>> débug.
>>>>> 
>>>>> --
>>>>> [EMAIL PROTECTED]
>>>>> The author of the freeware multi-tier middleware MidWare
>>>>> The author of the freeware Internet Component Suite (ICS)
>>>>> http://www.overbyte.be
>>>>> 
>>>>> 
>>>>> - Original Message -
>>>>> From: "David Perkins" <[EMAIL PROTECTED]>
>>>>> To: 
>>>>> Sent: Wednesday, September 19, 2007 4:24 PM
>>>>> Subject: [twsocket] FTP Server demo fails
>>>>> 
>>>>> 
>>>>>> Hello
>>>>>> 
>>>>>> I'm using the latest ICS and BCB2006 to test the ftp server demo.
>>>>>> When attempting to connect to the server from another PC using
>>>>>> filezilla it throws an exception in the OnAuthenticate event. 
>>>>>> I've narrowed it down and here is what makes it go pop:
>>>>>> 
>>>>>> void __fastcall TFtpServerForm::FtpServer1Authenticate(TObject
>>>>>> *Sender,  TFtpCtrlSocket *Client, TFtpString &UserName,
>>>>>> TFtpStri

Re: [twsocket] FTP Server demo fails

2007-09-20 Thread Arno Garrels
David Perkins wrote:
> Thank you Francois.
> 
> What's the state of v6, are people using it in production apps?

Yes, only there are probably still a few small bugs with native
BCB packages in current V6 download, I can post the fixes here if
you want. 

> Has
> v6 changed the requirement for a NOFORMS message pump at all?

NOFORMS forces to not include Forms.pas into ICS. It doesn't change
the fact that a message pump must exist.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
 
> 
> On 20/09/2007, Francois Piette <[EMAIL PROTECTED]> wrote:
>>> But am I corret in thinking it is only defined when I
>>> recompile the ICS components and not in my app itself?
>> 
>> Wrong. Define NOFORMS in /your/ application project.
>> 
>>>> Correct, that won't work of course. In your ThreadProc create the
>>>> component and call GetMessage(), TranslateMessage() and
>>>> DispatchMessage in a loop. Anything else can either be done from
>>>> the ICS events, or from handlers of custom messages posted to
>>>> Thread, i.e. to stop or start the server etc. 
>> 
>>> I still have to call GetMessage(), TranslateMessage() and
>>> DispatchMessage even with NOFORMS defined?
>> 
>> Yes you have. Those API calls are to create a message pump.
>> Delphi/BCB create such a message pump for you in all GUI
>> applications but don't create one in console mode applications nor
>> in any thread so you have to create your own.
>> 
>> There are sample console mode, service, and DLL program delivered
>> with ICS-V5. If you are using ICS-V6, you can still use those sample
>> programs probably just by changing the unit names in the uses clause
>> (prefix with OverByteIcs).
>> 
>> Contribute to the SSL Effort. Visit
>> http://www.overbyte.be/eng/ssl.html --
>> [EMAIL PROTECTED]
>> Author of ICS (Internet Component Suite, freeware)
>> Author of MidWare (Multi-tier framework, freeware)
>> http://www.overbyte.be
>> 
>> --
>> To unsubscribe or change your settings for TWSocket mailing list
>> please goto http://www.elists.org/mailman/listinfo/twsocket
>> Visit our website at http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] FTP Server - detecting when a new file has been uploaded

2007-09-20 Thread Arno Garrels
David Perkins wrote:
> I'm using ICS v5 to create an FTP server and wondered what is the
> preferred method of detecting when a new file has been uploaded? From
> what I can see, it's a combination of using OnValidatePut and
> OnStorSessionClosed.

I think that are the right places, however the logic to detect new
uploads still has to be invented. Note that both events will fire also
when partitial uploads start or finish. 

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
   
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] ICS Server raises external exception c000001d

2007-09-24 Thread Arno Garrels
Fastream Technologies wrote:
> What is a "first chance exception" anyway?

Google is your friend, anyway:
http://www.google.com/search?q=What+is+a+%22first+chance+exception%22

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

> 
> Regards,
> 
> SZ
> 
> - Original Message -
> From: "Francois Piette" <[EMAIL PROTECTED]>
> To: "ICS support mailing" 
> Sent: Monday, September 24, 2007 2:50 PM
> Subject: Re: [twsocket] ICS Server raises external exception c01d
> 
> 
>> http://www.google.be/search?q=C0d1
>> 
>>> Sometimes it gives "privileged instruction" and then crashes.
>> 
>> This usually happend when executing data as instructions. This mostly
>> result
>> of bad pointer or using an object or memory block after it has been
>> freed. 
>> 
>> --
>> [EMAIL PROTECTED]
>> Author of ICS (Internet Component Suite, freeware)
>> Author of MidWare (Multi-tier framework, freeware)
>> http://www.overbyte.be
>> 
>> - Original Message -
>> From: "Fastream Technologies" <[EMAIL PROTECTED]>
>> To: "ICS support mailing" 
>> Sent: Monday, September 24, 2007 11:37 AM
>> Subject: Re: [twsocket] ICS Server raises external exception c01d
>> 
>> 
>>> Corrected the message. See subject. Sometimes it gives "privileged
>>> instruction" and then crashes. I guess it is a critical section
>>> (lack of) problem but cannot find where! Any tool to show which
>>> line? MadExcept fails. 
>>> 
>>> Regards,
>>> 
>>> SZ
>>> 
>>> - Original Message -
>>> From: "Fastream Technologies" <[EMAIL PROTECTED]>
>>> To: "ICS support mailing" 
>>> Sent: Monday, September 24, 2007 12:18 PM
>>> Subject: ICS Server raises external exception 00d1
>>> 
>>> 
>>>> Hello,
>>>> 
>>>> What does this mean? How does an external exception differ from an
>>>> AV? 
>>>> 
>>>> Please help!
>>>> 
>>>> SZ
>>> 
>>> --
>>> To unsubscribe or change your settings for TWSocket mailing list
>>> please goto http://www.elists.org/mailman/listinfo/twsocket
>>> Visit our website at http://www.overbyte.be
>> 
>> --
>> To unsubscribe or change your settings for TWSocket mailing list
>> please goto http://www.elists.org/mailman/listinfo/twsocket
>> Visit our website at http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] 100% CPU usage if data is not processed immediately

2007-09-26 Thread Arno Garrels
Olivier Sannier wrote:

> 
> if bMore then
> Sleep(1); { to avoid 100% CPU }
> 
> At line 4231, right after the end of the try except block.
> To me this has little to no effect as the sleep is only done when
> bMore is True.
> What do you think of this proposal?

That would slow down performance when you use the component as designed.
When the application is idle it should read incomming data immediately.
There is no reason to wait until a certain amount of data is pending
to be read from winsock. 

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html


Olivier Sannier wrote:
> Hi,
> 
> I'm using TWSocketS with a custom TWSocket derived class called
> TMyClientSocket to implement a TCP/IP server.
> I have overridden TriggerDataAvailable in TMyClientSocket in such a
> way: 
> 
> function TROAsyncSuperTcpServerSocketClient.TriggerDataAvailable(
>   Error: Word): Boolean;
> begin
>   inherited TriggerDataAvailable(Error);
> 
>   NotifyDataAvailable;
> 
>   // Return True to indicate that we do not want the data to be
> dropped.   Result := True;
> end;
> 
> 
> The NotifyDataAvailable sets a flag in an object associated to the
> client socket that will then read the available bytes. But it will not
> do so immediately, clearly after the TriggerDataAvailable has
> returned. This does not prove to be a problem because all data is
> queued up until it is actually read, up to a certain limit that I
> doubt I'll ever reach. Usually, this takes a few milliseconds but it
> happens sometimes that it takes up to 10 seconds. Ok, this is
> relatively rare for production use, but because I'm doing tests on
> the server, I'm seeing this quite often. And this is where I have a
> problem, because while the data is waiting to be read, the processor
> usage is 100% (or 1CPU on multi cpu systems). I traced it and that's
> because TCustomWSocket.ASyncReceive does a loop while the bMore
> variable is True, without ever giving the operating system to do
> anything. Hence the 100%CPU usage. To me, this could be avoided by
> adding the following two lines at the end of the loop: 
> 
> if bMore then
> Sleep(1); { to avoid 100% CPU }
> 
> At line 4231, right after the end of the try except block.
> To me this has little to no effect as the sleep is only done when
> bMore is True.
> What do you think of this proposal?
> 
> Any comments are welcome.
> Regards
> Olivier Sannier
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] 100% CPU usage if data is not processed immediately

2007-09-26 Thread Arno Garrels
Olivier Sannier wrote:
 
> That's what I thought, but then again, this means I need to have a
> buffer of my own, and I have no idea which size it should be. 1k,
> 10k, more?

You have to use some buffer, its size depends on your protocol.
I.e. the client could send the data length as the first byte.
Or write received data to a stream if you like. Source code of the 
high level ICS components demonstrate how to do that in detail.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] newb using TWSocket for the first time

2007-09-26 Thread Arno Garrels
David Perkins wrote:

> By custom message handler, do you mean use a message map and define a
> new message type something like WM_USER+100?

Yes, you can also post the custom message to the hidden window that all
ICS components own and override component's  WndProc() to handle the new
message, note that in ICS-V6 additional messages have to registered and 
unregistered by overriding AllocateMsgHandlers() and FreeMsgHandlers().

> 
> Does this happen only if messages are pumped whilst in the
> OnDataAvailable event?

Reentrance-problems may occur in any other event as well when
messages are pumped in the event handler.  

> Would another thread calling processmessages
> give the same problems?

No, ProcessMessages retrieves messages from the thread message queue
and dispatch them to the default window procedure. 

--
Arno Garrels

> 
> Thanks.
> 
> 
> 
> On 26/09/2007, Wilfried Mestdagh <[EMAIL PROTECTED]> wrote:
>> Hello David,
>> 
>> Yes, a modal form is pumping messages. If it is really nececary to
>> popup a form if you have received a certain packet, you have to
>> create / show the form "outside" the OnDataAvailable event.
>> 
>> To do it outside just post a message to a custom message handler.
>> Your custom message handler will execute a while later (so outside
>> the event) and you can safely display the modal form. If you need
>> example, then just ask of course :)
>> 
>> ---
>> Rgds, Wilfried [TeamICS]
>> http://www.overbyte.be/eng/overbyte/teamics.html
>> http://www.mestdagh.biz
>> 
>> Wednesday, September 26, 2007, 16:19, David Perkins wrote:
>> 
>>> I now suspect that the data is only being sent once.
>> 
>>> When I receive a certain packet I pop up a messagebox asking the
>>> user a question and I suspect it is this that is causing the packet
>>> to be repeated since it is ultimately being displayed by a call
>>> from the OnDataAvailable event.
>> 
>>> How may this be prevented?  I cannot disable all messge processing
>>> in my app whilst it's in the OnDataAvailable event.
>> 
>> 
>>> On 26/09/2007, Wilfried Mestdagh <[EMAIL PROTECTED]> wrote:
>>>> Hello David,
>>>> 
>>>> Eventually you can check with SocketSpy what exacly is sent.
>>>> 
>>>> ---
>>>> Rgds, Wilfried [TeamICS]
>>>> http://www.overbyte.be/eng/overbyte/teamics.html
>>>> http://www.mestdagh.biz
>>>> 
>>>> --
>>>> To unsubscribe or change your settings for TWSocket mailing list
>>>> please goto http://www.elists.org/mailman/listinfo/twsocket
>>>> Visit our website at http://www.overbyte.be
>>>> 
>> 
>> --
>> To unsubscribe or change your settings for TWSocket mailing list
>> please goto http://www.elists.org/mailman/listinfo/twsocket
>> Visit our website at http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Wiki

2007-09-27 Thread Arno Garrels
Mike Sutton wrote:
> I thing a prominent link may help user, both new and
> existing.

That most likely would help to make the project moving forward.
I just added  some short-descriptions to the TSmtpCli main page.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html


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


Re: [twsocket] TWSocketThrdServer graceful shutdown

2007-09-28 Thread Arno Garrels
[EMAIL PROTECTED] wrote:
> Hello:
>  I using TWSocketThrdServer in a server
> application and was wondering if there is a
> recommended method to call for a graceful shutdown --
> one that will stop listening when all current
> connections are completed.

Call Close, that just stops listening, doesn't disconnect
connected clients, if that's what you mean.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html




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


Re: [twsocket] TWSocketThrdServer graceful shutdown

2007-09-28 Thread Arno Garrels
[EMAIL PROTECTED] wrote:
> Thanks Wilfried. Close() will do it.
> 
> What then does Shutdown(x) do?  I see that Close()
> calls it with an argument of 1 (SD_SEND), which
> according to a comment is for "graceful close".  Does
> it stop sending data?


Most likely Wilfried is faster again ;-)
Shutdown() initiates a bidirectional shutdown procedure of a
connection, the listening socket however has no connection,
so calling TWSocketServer.Close is fine.
Call Shutdown(1) on the client socket when all data has been
sent (OnDataSent), it disables subsequent sends on the socket,
however data still pending in winsock buffer will be sent 
nevertheless.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
> 
> 
> 
>> --- Original Message ---
>>> From: Wilfried
> Mestdagh[mailto:[EMAIL PROTECTED]
>> Sent: 9/28/2007 12:03:57 PM
>> To  : twsocket@elists.org
>> Cc  :
>> Subject : RE: Re: [twsocket] TWSocketThrdServer
> graceful shutdown
>> 
>  >Hello dz,
> 
> Just call Close method. server will stop listening.
> Note that calling
> Close will not stop current connections, it only
> stops listening.
> 
> ---
> Rgds, Wilfried [TeamICS]
>  http://www.overbyte.be/eng/overbyte/teamics.html
>  http://www.mestdagh.biz
> 
> Friday, September 28, 2007, 17:44, [EMAIL PROTECTED] wrote:
> 
>> Hello:
>>  I using TWSocketThrdServer in a server
>> application and was wondering if there is a
>> recommended method to call for a graceful shutdown --
>> one that will stop listening when all current
>> connections are completed.
> 
>>  Thanks,
>>  -dZ.
> 
> 
> --
> To unsubscribe or change your settings for TWSocket
> mailing list
> please goto
> http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at  http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TWSocketThrdServer graceful shutdown

2007-09-28 Thread Arno Garrels
Wilfried Mestdagh wrote:
> Hello Arno,
> 
>> Most likely Wilfried is faster again ;-)
> 
> most of the time you are faster :)

Isn't this list great? Where else do you get faster support for
free software? 

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

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


Re: [twsocket] Bug in OverbyteICSHttpProt.pas

2007-09-30 Thread Arno Garrels
Fastream Technologies wrote:
Any ideas??

Are you using the same ICS-files that worked with BCB2006?
The package compiles and a new VCL-Application with a THttpCli
dropped on the form compiles as well. Remember that you and
I made some changes to get it working in BCB, those changes are
not yet in any other distributions.

The only strange thing I do not understand is that all icons
are missing in the Tool-Palette of BCB2007, anybody any idea?

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

 

> 
> THANKS.
> 
> Gorkem
> 
> 
> On 9/30/07, Francois PIETTE <[EMAIL PROTECTED]> wrote:
>> 
>> I have no problem to compile a simple console mode project with those
>> defines.
>> Please tell me what are the exact errors and where they occurs.
>> 
>> Contribute to the SSL Effort. Visit
>> http://www.overbyte.be/eng/ssl.html --
>> [EMAIL PROTECTED]
>> The author of the freeware multi-tier middleware MidWare
>> The author of the freeware Internet Component Suite (ICS)
>> http://www.overbyte.be
>> 
>> - Original Message -
>> From: "Fastream Technologies" <[EMAIL PROTECTED]>
>> To: "ICS support mailing" 
>> Sent: Sunday, September 30, 2007 3:20 PM
>> Subject: [twsocket] Bug in OverbyteICSHttpProt.pas
>> 
>> 
>>> Hello,
>>> 
>>> Could somebody please try to compile this unit with the defines:
>>> 
>>> NOFORMS;SECURITY_WIN32;
>>> 
>>> and no content-coding, no bandwidth limitation and no NTLM? It gives
>>> strange
>>> pascal errors that needs fixes.
>>> 
>>> BTW, to test the behavior, please modify your source top part as,
>>> 
>>> {$IFDEF COMPILER5_UP}
>>> {$IFNDEF NO_ADVANCED_HTTP_CLIENT_FEATURES} //NEW
>>>{$DEFINE UseNTLMAuthentication}
>>>{$DEFINE UseBandwidthControl}
>>>{$DEFINE UseContentCoding}
>>> {$ENDIF} // NEW
>>> {$ENDIF}
>>> 
>>> I believ ethere are low-level people like us who do not need these
>>> high-level features.
>>> 
>>> SZ
>>> --
>>> To unsubscribe or change your settings for TWSocket mailing list
>>> please goto http://www.elists.org/mailman/listinfo/twsocket
>>> Visit our website at http://www.overbyte.be
>> 
>> --
>> To unsubscribe or change your settings for TWSocket mailing list
>> please goto http://www.elists.org/mailman/listinfo/twsocket
>> Visit our website at http://www.overbyte.be
>> 
> 
> 
> 
> --
> CSA, Fastream Technologies
> Software IQ: Innovation & Quality
> www.fastream.com | Email: [EMAIL PROTECTED] | Tel: +90-312-223-2830
> Join IQWF Server Yahoo group at
> http://groups.yahoo.com/group/IQWFServer Join IQ Reverse Proxy Yahoo
> group at http://groups.yahoo.com/group/IQReverseProxy
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Bug in OverbyteICSHttpProt.pas

2007-09-30 Thread Arno Garrels
Arno Garrels wrote:
> Fastream Technologies wrote:
> Any ideas??

Sorry, my green light was given too early and you are right,
there are indeed a few small bugs in procedure THttpCli.GetBodyLineNext
when UseContentCoding is not defined in the parts dealing with
chunked encoding. Francois can you please check that again?

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html



> 
> Are you using the same ICS-files that worked with BCB2006?
> The package compiles and a new VCL-Application with a THttpCli
> dropped on the form compiles as well. Remember that you and
> I made some changes to get it working in BCB, those changes are
> not yet in any other distributions.
> 
> The only strange thing I do not understand is that all icons
> are missing in the Tool-Palette of BCB2007, anybody any idea?





> 
> --
> Arno Garrels [TeamICS]
> http://www.overbyte.be/eng/overbyte/teamics.html
> 
> 
> 
>> 
>> THANKS.
>> 
>> Gorkem
>> 
>> 
>> On 9/30/07, Francois PIETTE <[EMAIL PROTECTED]> wrote:
>>> 
>>> I have no problem to compile a simple console mode project with
>>> those defines.
>>> Please tell me what are the exact errors and where they occurs.
>>> 
>>> Contribute to the SSL Effort. Visit
>>> http://www.overbyte.be/eng/ssl.html --
>>> [EMAIL PROTECTED]
>>> The author of the freeware multi-tier middleware MidWare
>>> The author of the freeware Internet Component Suite (ICS)
>>> http://www.overbyte.be
>>> 
>>> - Original Message -
>>> From: "Fastream Technologies" <[EMAIL PROTECTED]>
>>> To: "ICS support mailing" 
>>> Sent: Sunday, September 30, 2007 3:20 PM
>>> Subject: [twsocket] Bug in OverbyteICSHttpProt.pas
>>> 
>>> 
>>>> Hello,
>>>> 
>>>> Could somebody please try to compile this unit with the defines:
>>>> 
>>>> NOFORMS;SECURITY_WIN32;
>>>> 
>>>> and no content-coding, no bandwidth limitation and no NTLM? It
>>>> gives strange
>>>> pascal errors that needs fixes.
>>>> 
>>>> BTW, to test the behavior, please modify your source top part as,
>>>> 
>>>> {$IFDEF COMPILER5_UP}
>>>> {$IFNDEF NO_ADVANCED_HTTP_CLIENT_FEATURES} //NEW
>>>>{$DEFINE UseNTLMAuthentication}
>>>>{$DEFINE UseBandwidthControl}
>>>>{$DEFINE UseContentCoding}
>>>> {$ENDIF} // NEW
>>>> {$ENDIF}
>>>> 
>>>> I believ ethere are low-level people like us who do not need these
>>>> high-level features.
>>>> 
>>>> SZ
>>>> --
>>>> To unsubscribe or change your settings for TWSocket mailing list
>>>> please goto http://www.elists.org/mailman/listinfo/twsocket
>>>> Visit our website at http://www.overbyte.be
>>> 
>>> --
>>> To unsubscribe or change your settings for TWSocket mailing list
>>> please goto http://www.elists.org/mailman/listinfo/twsocket
>>> Visit our website at http://www.overbyte.be
>>> 
>> 
>> 
>> 
>> --
>> CSA, Fastream Technologies
>> Software IQ: Innovation & Quality
>> www.fastream.com | Email: [EMAIL PROTECTED] | Tel: +90-312-223-
>> 2830 Join IQWF Server Yahoo group at
>> http://groups.yahoo.com/group/IQWFServer Join IQ Reverse Proxy Yahoo
>> group at http://groups.yahoo.com/group/IQReverseProxy
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Another BCB2007 compatibility problem (of demos)

2007-10-01 Thread Arno Garrels
Francois PIETTE wrote:
>> RAD Studio 2007 brings ICS? Is it in the additional
>> components, or as part of the default distribution?
> 
> It is on the "Partner DVD". Also available on-line from CodeCentral.
> http://cc.codegear.com/Item/24572

Most people won't download the partner DVD just to get the latest ICS
distribution. Everybody expects that the same, or even a newer version
is available on your website. If that's not case please change that. 

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html




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


Re: [twsocket] New ICS-V6 beta available - updated for RAD Studio 2007

2007-10-03 Thread Arno Garrels
MimeUtils.pas must be exchanged since functions
DoFileEncQuotedPrintable and DoTextFileReadNoEncoding 
inroduce bugs. Though DoTextFileReadNoEncoding is not
currently used but instead Bjørnar's code. Bjørnar's
code is much faster BUT it adds an additional CRLF at
the end of an unencoded attachment which I call a bug
as well.

In order to use my DoTextFileReadNoEncoding you need
a modified OverbyteIcsSmtpProt.pas as well. Both files
are included in the package I uploaded here:

http://www.duodata.de/misc/delphi/V6SmtpAndMimeUtils.zip

Again, regardless what version of OverbyteIcsSmtpProt.pas 
is used MimeUtils.pas MUST be exchanged due to a bug in
DoFileEncQuotedPrintable.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html




Francois PIETTE wrote:
> There is a new ICS-V6 beta available. Updated for RAD Studio 2007.
> Still OK for Delphi 7.
> Thanks to Arno Garrels, Bjornar Nielsen, Fastream and many orthers
> for their help.
> 
> --
> [EMAIL PROTECTED]
> The author of the freeware multi-tier middleware MidWare
> The author of the freeware Internet Component Suite (ICS)
> http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TWSocketThrdServer - Bogus OnDataAvailable triggeredwhen Closed.

2007-10-03 Thread Arno Garrels
Olivier Sannier wrote:
> Isn't it what CloseDelayed is meant for?

CloseDelayed won't reenter the event, however to ensure that
last data packets are received properly before the socket is
closed call ShutDown() for a gracefull close in DataSent event
handler.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

> 
> Francois Piette wrote:
>> You should call Shutdown to gracefully close the connection.
>> If you want to call close, do it using an intermediate custom
>> message. --
>> [EMAIL PROTECTED]
>> Author of ICS (Internet Component Suite, freeware)
>> Author of MidWare (Multi-tier framework, freeware)
>> http://www.overbyte.be
>> 
>> 
>> - Original Message -
>> From: <[EMAIL PROTECTED]>
>> To: 
>> Sent: Wednesday, October 03, 2007 12:04 AM
>> Subject: [twsocket] TWSocketThrdServer - Bogus OnDataAvailable
>> triggeredwhen Closed.
>> 
>> 
>> 
>>> Hello:
>>> I'm using TWSocketThrdServer and processing
>>> client data from within the OnDataAvailable event
>>> handler (client is set to LineMode=True).  I've
>>> noticed that if the data transaction is completed and
>>> I call Client.Close from within this event, the event
>>> is called again with the previous ReceivedStr.
>>> 
>>> Here's a sample of the code I am using:
>>> 
>>> Procedure TMyServer.HandleDataAvailable(Sender:
>>> TObject; Error: Word);
>>> Var
>>>   DataStr: String;
>>>   bDone: Boolean;
>>> Begin
>>>   If (Error = 0) Then Begin
>>> With (Sender As TMyClient) Do Begin
>>>   DataStr := ReceiveStr;
>>> 
>>>   // parse the DataStr and do
>>>   // whatever needs to be done.
>>>   // bDone may be set here.
>>> 
>>>   If (bDone) Then Begin
>>> SendLine('Sayonara.');
>>> TMyClient(Sender).Close; // <<-- HERE!
>>>   End;
>>> End;
>>>   End Else Begin
>>> // Handle errors...
>>> TMyClient(Sender).Abort;
>>>   End;
>>> End;
>>> 
>>> When that Close method is called, the event is
>>> immediately re-entered with the same data.  Am I
>>> doing something stupid?
>>> 
>>> Thanks,
>>> -dZ.
>>> 
>>> --
>>> To unsubscribe or change your settings for TWSocket mailing list
>>> please goto http://www.elists.org/mailman/listinfo/twsocket
>>> Visit our website at http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TWSocketThrdServer - Bogus OnDataAvailabletriggeredwhen Closed.

2007-10-03 Thread Arno Garrels
Wilfried Mestdagh wrote:
> Hello DZ-Jay,
> 
>> Close() ultimately calls Shutdown(1) -- so wouldn't it have the same
>> effect?
> 
> As I recall not exacly the same. Close calls Shutdown(1) and close the
> socket. If you call Shutdown(1) the socket will not be immediatly
> close, but if there is still some data it will be send, and the other
> end will tell it is ready to close when receiving the data. Then the
> socket will be closed by winsock (and OnSessionClosed is then called).
> 
>> I thought the buffer
>> was cleared when read (ReceivedStr property), or am I wrong?
> 
> Yes it is. If OnDataAvailable is called when you call close (with some
> data) then the other end has send some data, or there is somewhere a
> re-entrance problem (somewhere calling the message pump?).

I think the problem is that in TCustomWSocket.InternalClose the message
pump is called. Anyway calling Send() immediately followed be CloseDelay
will most likely (not always) lead to truncated data on the client side.  

Best practice when calling ShutDown(1) from OnDataSent is starting a timer
to detect timeouts when the client should ignore the ShutDown, just in case. 

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

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


Re: [twsocket] Using SourceForge for ICS ?

2007-10-03 Thread Arno Garrels
Maurizio Lotauro wrote:

> I see that jcl has switched from CVS to SVN, so probably it will be
> better to choice SVN.

Yes, and TortoiseSVn looks like a very cool and powerfull tool on the
first glance!

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html




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


Re: [twsocket] TWSocketThrdServer stuck in destructor loopwhenkilling threads

2007-10-04 Thread Arno Garrels
[EMAIL PROTECTED] wrote:
> Now, since all exceptions are being swallowed by the
> TWSocket component, if I need to kill the entire app
> from, say, an event within the TWSocketThrdSrv (for
> example in OnBgException), should I post a message to
> the main thread, or is there a better way?

You may want to detect when the ServerThread terminates
in general the you can either restart the thread or
terminate the application depending on a flag or error
code sent in a custom message. In OnBgException the
flag or error can be set, something like that.

Procedure TServerThrd.Execute;
 Begin
   Try
 FSocketSrv := TWSocketThrdServer.Create(Nil);
 FSocketSrv.Listen();
 FSocketSrv.MessageLoop;
   Finally

 // Add
 FSocketSrv.Free;
 PostMessage(AppHwnd, WM_SERVERTHREAD_WILL_TERMINATE_SOON, ErrorCode, 
RestartMe); 
   End;
 End;
 
--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html





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


Re: [twsocket] Using SourceForge for ICS ?

2007-10-07 Thread Arno Garrels
DZ-Jay wrote:
> On Oct 5, 2007, at 02:49, Olivier Sannier wrote:
> 
> SubVersion on the other hand was created to enable more efficient
> collaboration, purely as a source control tool.  You can mark files
> with "requires lock", which will require a developer to acquire a lock
> before committing changes.  We use this mostly for sensitive files
> where a merge gone awry may be critical; or for project documentation,
> which should not change that often.  In the case of ICS, for example,
> *if* you were to use locking, I would suggest it on the highest files
> of the TWSocket class hierarchy, which if changed, may affect all
> other units.  That way you make sure that, say, Francois and Arno
> will not be changing the same things at the same time.

Isn't it safe to use the Copy-Modify-Merge solution, described in the
online-help ? 

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html




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


Re: [twsocket] Using SourceForge for ICS ?

2007-10-08 Thread Arno Garrels
DZ-Jay wrote:
> On Oct 7, 2007, at 14:57, Arno Garrels wrote:
> 
>> Isn't it safe to use the Copy-Modify-Merge solution, described in the
>> online-help ?
> 
> Yes, it is very safe.  

Now that I checked how to merge particular changes made in
branches to the main source tree under trunk I would like
to suggest the following, same structure for two different
repositories one for V5 and one for V6:

/icsv(n)
  |-branches
  |  |-ics-ssl
  |-tags
  |  |-ics-ssl
  |  |  |- beta(n)
  |  |-ics
  | |- release(n)
  |-trunk
 |-ics

Where the ics-ssl branch and tags cannot be accessed by
common ics users. AFAIK it is only possible to merge
between common and SSL when the SSL code is in the same
repository, is that true? It works very well and makes it
very easy to maintain. If Francois does not want to put the
SSL code into the project/repository as well ? I think we
won't safe very much. What do you think?

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html




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


Re: [twsocket] Using SourceForge for ICS ?

2007-10-08 Thread Arno Garrels
[EMAIL PROTECTED] wrote:
>> /icsv(n)
>>   |-branches
>>   |  |-ics-ssl
>>   |-tags
>>   |  |-ics-ssl
>>   |  |  |- beta(n)
>>   |  |-ics
>>   | |- release(n)
>>   |-trunk
>>  |-ics
> 
> There's a few questions I have with your suggested
> structure:
> 
> 1. Is ICS-SSL really a branch of ICS, or should it be
> considered a separate project?  

It's no separate project. It shares most of the files with
common ICS, most of the SSL code is available as .inc files
compiled in conditionally. And it has its own demo-folder.  

> Branches, in my
> opinion, should be temporary code paths destined to
> eventually merge with the main trunk, 

Basically that's true, however think of it as a persistent
branch, you can change everything however ever only merge
those changes to the main trunk effecting the shared files.
People can work with either common ICS or SSL and commit
their changes. Merging with the branch or the other way around
was very easy (allowed to admin users only). But I just read
Francois reply, so this discussion is useless in any case. 

> 
> 2. Does ICS v6 represent a completely different
> code-base than ICS v5, or is it a natural progression
> for it? 

It's the latter, however the point when V6 has been split from
the common base is already some years back and hard to restore.
There will be no new features in V5 so merging between V5 and V6
is most likely not required. Also revision numbers are incremented
for the entire project/repository. But I could very well live with
both in the same repository as well, locally I also treat them as
two different projects.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html


> If the former, then they indeed should be
> separte projects.  But if the latter, they should
> form part of the same code base:  If ICS v5 is
> currently the "stable" version, and ICS v6 represents
> a new version that will eventually supplant it, then
> I suggest ICS v5 represent the main trunk, and ICS v6
> become a branch of it.  Once ICS v6 matures and
> replaces v5, it will be merged into the main trunk,
> and v5 set as a Tag.  But if v6 represents the
> version where most development will be done, and v5
> is only for legacy support, then it should be the
> other way around.


> 
> Also, keep in mind that merging is done locally in
> the user's working directory, not directly in the
> repository.  
> To merge, you select a source path from
> the repository, and specify which revisions to
> include; SVN will then merge those changes with your
> working directory (representing the target repository
> path).  Once all conflicts are resolved, the updated
> (merged) working directory can be commited by the user.
> 
> Therefore, it is possible for users to revert
> accidentally changes commited previously, by
> commiting "wrongly" merged files.  The good thing is
> that the changes were not lost (they are still in the
> repository history), and can easily be returned.
> 
> By "wrongly merged files", I mean that the user
> mistakenly overwrote other's changes with his own or
> with an older version of code.  This is the scenario
> that I alluded to before, and it is fairly common
> among people who are not used to version control systems.
> 
> -dZ.
> 
> 
> 
>> --- Original Message ---
>>> From: Arno Garrels[mailto:[EMAIL PROTECTED]
>> Sent: 10/8/2007 1:03:09 PM
>> To  : twsocket@elists.org
>> Cc  :
>> Subject : RE: Re: [twsocket] Using SourceForge for ICS ?
>> 
>  >DZ-Jay wrote:
>> On Oct 7, 2007, at 14:57, Arno Garrels wrote:
>> 
>>> Isn't it safe to use the Copy-Modify-Merge solution, described in
>>> the online-help ?
>> 
>> Yes, it is very safe.
> 
> Now that I checked how to merge particular changes
> made in
> branches to the main source tree under trunk I would like
> to suggest the following, same structure for two
> different
> repositories one for V5 and one for V6:
> 
> /icsv(n)
>   |-branches
>   |  |-ics-ssl
>   |-tags
>   |  |-ics-ssl
>   |  |  |- beta(n)
>   |  |-ics
>   | |- release(n)
>   |-trunk
>  |-ics
> 
> Where the ics-ssl branch and tags cannot be accessed by
> common ics users. AFAIK it is only possible to merge
> between common and SSL when the SSL code is in the same
> repository, is that true? It works very well and makes it
> very easy to maintain. If Francois does not want to
> put the
> SSL code into the project/repository as well ? I think we
> won't safe very much. What do you think?
> 
> --
> Arno Garrels [TeamICS]
>  http://www.overbyte.be/eng/overbyte/teamics.html
> 
> 
> 
> 
> --
> To unsubscribe or change your settings for TWSocket
> mailing list
> please goto
> http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at  http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Using SourceForge for ICS ?

2007-10-08 Thread Arno Garrels
Francois PIETTE wrote:
>> very easy to maintain. If Francois does not want to put the
>> SSL code into the project/repository as well ? I think we
>> won't safe very much. What do you think?
> 
> Currently I don't plan to put ICS-SSL on SourceForge.

The goal is to make development easier for a workgroup isn't it?
ICS can only benefit from such a concept. That must not mean
to move the source to SourceForge, all we need is a server that
runs SVN, 24 hours a day, ideally under your control.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
  

> 
> --
> [EMAIL PROTECTED]
> The author of the freeware multi-tier middleware MidWare
> The author of the freeware Internet Component Suite (ICS)
> http://www.overbyte.be
> 
> 
> - Original Message -
> From: "Arno Garrels" <[EMAIL PROTECTED]>
> To: "ICS support mailing" 
> Sent: Monday, October 08, 2007 7:03 PM
> Subject: Re: [twsocket] Using SourceForge for ICS ?
> 
> 
>> DZ-Jay wrote:
>>> On Oct 7, 2007, at 14:57, Arno Garrels wrote:
>>> 
>>>> Isn't it safe to use the Copy-Modify-Merge solution, described in
>>>> the online-help ?
>>> 
>>> Yes, it is very safe.
>> 
>> Now that I checked how to merge particular changes made in
>> branches to the main source tree under trunk I would like
>> to suggest the following, same structure for two different
>> repositories one for V5 and one for V6:
>> 
>> /icsv(n)
>>  |-branches
>>  |  |-ics-ssl
>>  |-tags
>>  |  |-ics-ssl
>>  |  |  |- beta(n)
>>  |  |-ics
>>  | |- release(n)
>>  |-trunk
>> |-ics
>> 
>> Where the ics-ssl branch and tags cannot be accessed by
>> common ics users. AFAIK it is only possible to merge
>> between common and SSL when the SSL code is in the same
>> repository, is that true? It works very well and makes it
>> very easy to maintain. If Francois does not want to put the
>> SSL code into the project/repository as well ? I think we
>> won't safe very much. What do you think?
>> 
>> --
>> Arno Garrels [TeamICS]
>> http://www.overbyte.be/eng/overbyte/teamics.html
>> 
>> 
>> 
>> 
>> --
>> To unsubscribe or change your settings for TWSocket mailing list
>> please goto http://www.elists.org/mailman/listinfo/twsocket
>> Visit our website at http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Using SourceForge for ICS ?

2007-10-08 Thread Arno Garrels
Francois PIETTE wrote:
>> The goal is to make development easier for a workgroup isn't it?
> 
> Yes, it is.
> 
>> ICS can only benefit from such a concept. That must not mean
>> to move the source to SourceForge, all we need is a server that
>> runs SVN, 24 hours a day, ideally under your control.
> 
> What are the requirement for such a server ?

If there are just a few users members of the development team and
main distribution of the source remains dowloading archives from your
website I think that a ADSL line was totally OK. There's a svnserver
that can be installed as a service and also a plugin for Apache 
(more secure, allows SSL) both well documented in the online help. 

> 
> --
> [EMAIL PROTECTED]
> The author of the freeware multi-tier middleware MidWare
> The author of the freeware Internet Component Suite (ICS)
> http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TWSocketThrdServer friendly notice whendisconnecting.

2007-10-11 Thread Arno Garrels
DZ-Jay wrote:
> Thanks, Wilfried.  That's what I'm doing now.  However, I'm doing it
>> from the end of the Execute() method of the worker thread, right
>> before 
> destroying the server, like this:
> 
> Procedure WorkerThread.Execute;
> Begin
>_InitializeSrv();  // create
>Try
>  Srv.MessageLoop();
>Finally
>  Try
>For n := 0 to (Srv.ClientCount - 1) Do Begin
>  Srv.Clients[n].SendStr('bye'#13#10);
>  Srv.Clients[n].ShutDown(1);
>End;
>  Finally
>Srv.Free;
>  End;
>End;
> End;

Iterating thru Srv.Clients is not the way to go!! It is not
thread-save and will most likely throw strange AVs. Instead
iterate thru the thread-list and post a custom message to each
thread, the inside the thread iterate thru each thread's 
client list, see TWSocketThrdServer.DisconnectAll as example.
Now one problem is that TWSocketThrdServer has no public property
ThreadList and TWsClientThread.PumpMessages doesn't fire an event
OnMessage. So the code has to be tweaked a little bit for common use. 
The only reason why I started writing this component was to derive
a SSL multi-threaded server from it only to be able to test 
thread-safety of the SSL code. 

> 
> The problem that I saw was that Calling Shutdown(1) would cause the
> server to trigger OnClientDisconnect, which may fire *after* the
> thread and client were distroyed by Srv.Free, which will raise an
> exception that I would like to avoid if possible.  So, what I did was
> not call ShutDown(1), and expect the shutdown to occur when
> destroying the Srv, like this:
> 
>  Try
>    Srv.Shutdown(0); // make sure we do not accept anybody else!

Here Srv.Close is the correct method to call.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html




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


Re: [twsocket] TWSocketThrdServer friendly notice whendisconnecting.

2007-10-11 Thread Arno Garrels
DZ-Jay wrote:
> On Oct 11, 2007, at 06:47, Arno Garrels wrote:
> 
>> Iterating thru Srv.Clients is not the way to go!! It is not
>> thread-save and will most likely throw strange AVs. Instead
>> iterate thru the thread-list and post a custom message to each
>> thread, the inside the thread iterate thru each thread's
>> client list, see TWSocketThrdServer.DisconnectAll as example.
>> Now one problem is that TWSocketThrdServer has no public property
>> ThreadList and TWsClientThread.PumpMessages doesn't fire an event
>> OnMessage. So the code has to be tweaked a little bit for common use.
> 
> So, would you recommend that I extend the component and override
> DisconnectAll to, say, fire an event that I could hook on to send the
> messages; and then call DisconnectAll() from my worker thread instead
> of using the loop?  If so, we should add something like this to the
> component itself, no? (I could provide the code when I'm done with
> it.)

I suggest an event OnMessage that fires from PumpMessages like this:

TMessageEvent = procedure(Sender: TObject; var Msg: TMessage; var Handled: 
Boolean);
TWsClientThread = class(TThread)
private
FReadyForMsgs : Boolean;
FServer   : TWSocketThrdServer;
FClients  : TList;
FEventArray   : array [TWsClientThreadEventID] of THandle;
FOnMessage: TMessageEvent;
protected
procedure   DetachClient(Client: TWSocketThrdClient);
procedure   AttachClient(Client: TWSocketThrdClient);
procedure   DisconnectAll;
procedure   PumpMessages(WaitForMessages : Boolean); virtual;
procedure   Execute; override;
functionGetClientCount : Integer;
public
constructor Create(Suspended : Boolean);
destructor  Destroy; override;
propertyClientCount  : Integer read  GetClientCount;
propertyReadyForMsgs : Boolean read  FReadyForMsgs;
propertyOnMessage: TMessageEvent   read  FOnMessage
   write FOnMessage;
end;

procedure TWsClientThread.PumpMessages(WaitForMessages: Boolean);
..
WM_THREAD_EXCEPTION_TEST :
raise Exception.Create('** TEST EXCEPTION ***')
else
MsgRec.Msg:= Msg.message;
MsgRec.WParam := Msg.wParam;
MsgRec.LParam := Msg.lParam;
Handled := False;
if Assigned(FOnMessage) then
FOnMessage(Self, MsgRec, Handled);
if not Handled then
Dispatch(MsgRec);
end;

This is untested code. Also FThreadList has to be made public.
Note that OnMessage would fire in different thread contexts but
a single handler for all is fine. Hope this helps.

> 
>> The only reason why I started writing this component was to derive
>> a SSL multi-threaded server from it only to be able to test
>> thread-safety of the SSL code.
> 
> Are you suggesting the component is not stable for a production
> application?

I think it isn't very fast, I tested once with some stress
clients and many concurrent connections successfully over many
hours until that point it looked stable. In any case I won't use
multi-threading if not absolutely necessary, simply because it's
easier to code and to debug. TWSocketServer can handle many hundreds
of concurrent connections in a single thread.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

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


Re: [twsocket] TWSocketThrdServer friendly notice whendisconnecting.

2007-10-11 Thread Arno Garrels
Btw: Should read:
TMessageEvent = procedure(Sender: TObject; var Msg: TMessage; var Handled: 
Boolean) of object;

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


Re: [twsocket] TWSocketThrdServer friendly notice whendisconnecting.

2007-10-11 Thread Arno Garrels
[EMAIL PROTECTED] wrote:
> Hello:
>Although impressive, that type of performance is
> out of the scope of my application, which won't be
> handling more than 100 (but mostly dozens)
> connections at a time.  I guess TWSocketServer is the
> way to go for me.

Yes I think so. You only must ensure that lengthy, blocking
tasks are moved into worker threads in order to not slow down
response time to all other clients too much or not to block
subsequent connection attempts. 

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
 


> 
> 
>> --- Original Message ---
>>> From: Fastream
> Technologies[mailto:[EMAIL PROTECTED]
>> Sent: 10/11/2007 10:08:16 AM
>> To  : twsocket@elists.org
>> Cc  :
>> Subject : RE: Re: [twsocket] TWSocketThrdServer friendly notice
>> whendisconnecting. 
>> 
>  >I test my ICS-based MT proxy with 20k connections
> on our dual-core system.
> It performs 2GBps, local-to-local. So that's one CPU
> performance basically
> since the tester also uses CPU! I would not imagine
> such performance with
> single thread.
> 
> Best Regards,
> 
> SZ
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TWSocketThrdServer friendly notice whendisconnecting.

2007-10-11 Thread Arno Garrels
Fastream Technologies wrote:
> I test my ICS-based MT proxy with 20k connections on our dual-core
> system. It performs 2GBps, local-to-local. So that's one CPU
> performance basically since the tester also uses CPU! I would not
> imagine such performance with single thread.

Those numbers don't tell me much. I'm missing a serious
comparison between an optimized MT and an optimzed ST server.
One comparison was how many clients can be connected until the
first is being rejected due to a full ListenBackLogQueue.
Another was how long would it take until all clients finished
their concurrent download.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

> 
> Best Regards,
> 
> SZ
> 
> 
> On 10/11/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> 
>> --- QUOTE: SZ
>> If you do not want the ability to use multi-cores for
>> communication threads,
>> then async is the way to go. But IMO, it is an ill
>> design since chipmakers
>> are talking about 64-core CPUs and 10Gbps networks.
>> --- END.
>> 
>> Thanks, SZ.  At this point I'm not so much concerned
>> about complexity (although, of course, that is a
>> concern), but more about performance and efficiency.
>> I know that the arguments are always against
>> multiple threads because they are harder to debug and
>> synchronize, which is a very valid argument, and one
>> that's biting me in the ass right now, but is that at
>> the cost of a perceivable performance hit?  Or is the
>> async component not only simpler to use, but just as
>> fast (or at least not significantly slower)?
>> 
>>   -dZ.
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Bug (yet another?) in THttpCli

2007-10-11 Thread Arno Garrels
Fastream Technologies wrote:
>  if(method == "GET")
>   bufferClient->GetASync(); // here gives "Busy" error, WHY? ISN'T
> THIS THE PROPER WAY TO USE THE COMPONENT??

I cannot reproduce this? Any special environment required?

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html


 

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


Re: [twsocket] Bug (yet another?) in THttpCli

2007-10-12 Thread Arno Garrels
Fastream Technologies wrote:
> Of course I use:
> 
> USE_SSL;NO_DEBUG_LOG;NOFORMS;SECURITY_WIN32;NO_ADVANCED_HTTP_CLIENT_FEATURES
> 
> in defines.

They are defined in your project. And it is not built with runtime
packages, so no need to define them in the ICS package as well.


 
> Thanks,
> 
> SZ
> 
> 
> On 10/11/07, Arno Garrels <[EMAIL PROTECTED]> wrote:
>> 
>> Fastream Technologies wrote:
>>>  if(method == "GET")
>>>   bufferClient->GetASync(); // here gives "Busy" error, WHY? ISN'T
>>> THIS THE PROPER WAY TO USE THE COMPONENT??
>> 
>> I cannot reproduce this? Any special environment required?
>> 
>> --
>> Arno Garrels [TeamICS]
>> http://www.overbyte.be/eng/overbyte/teamics.html
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TWSocketThrdServer friendly notice whendisconnecting.

2007-10-14 Thread Arno Garrels
Fastream Technologies wrote:
> What I tried to explain was that if your program is TCP/IP-dense,
> then in order to take advantage of multi-cores, you MUST code MT.

That's true, but does that neccessarily mean that you MUST run socket
communication in multiple threads? I can think of many other bottlenecks
that could benefit from MT.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
  

> 
> Regards,
> 
> SZ
> 
> 
> On 10/11/07, Arno Garrels <[EMAIL PROTECTED]> wrote:
>> 
>> Fastream Technologies wrote:
>>> I test my ICS-based MT proxy with 20k connections on our dual-core
>>> system. It performs 2GBps, local-to-local. So that's one CPU
>>> performance basically since the tester also uses CPU! I would not
>>> imagine such performance with single thread.
>> 
>> Those numbers don't tell me much. I'm missing a serious
>> comparison between an optimized MT and an optimzed ST server.
>> One comparison was how many clients can be connected until the
>> first is being rejected due to a full ListenBackLogQueue.
>> Another was how long would it take until all clients finished
>> their concurrent download.
>> 
>> --
>> Arno Garrels [TeamICS]
>> http://www.overbyte.be/eng/overbyte/teamics.html
>> 
>>> 
>>> Best Regards,
>>> 
>>> SZ
>>> 
>>> 
>>> On 10/11/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>>>> 
>>>> --- QUOTE: SZ
>>>> If you do not want the ability to use multi-cores for
>>>> communication threads,
>>>> then async is the way to go. But IMO, it is an ill
>>>> design since chipmakers
>>>> are talking about 64-core CPUs and 10Gbps networks.
>>>> --- END.
>>>> 
>>>> Thanks, SZ.  At this point I'm not so much concerned
>>>> about complexity (although, of course, that is a
>>>> concern), but more about performance and efficiency.
>>>> I know that the arguments are always against
>>>> multiple threads because they are harder to debug and
>>>> synchronize, which is a very valid argument, and one
>>>> that's biting me in the ass right now, but is that at
>>>> the cost of a perceivable performance hit?  Or is the
>>>> async component not only simpler to use, but just as
>>>> fast (or at least not significantly slower)?
>>>> 
>>>>   -dZ.
>> --
>> To unsubscribe or change your settings for TWSocket mailing list
>> please goto http://www.elists.org/mailman/listinfo/twsocket
>> Visit our website at http://www.overbyte.be
>> 
> 
> 
> 
> --
> Fastream Technologies
> Software IQ: Innovation & Quality
> www.fastream.com | Email: [EMAIL PROTECTED] | Tel: +90-312-223-2830
> Join IQWF Server Yahoo group at
> http://groups.yahoo.com/group/IQWFServer Join IQ Reverse Proxy Yahoo
> group at http://groups.yahoo.com/group/IQReverseProxy
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] ICS FTP Client list command result

2007-10-15 Thread Arno Garrels
Ian Thompson wrote:
> Hi.
> 
> Just started using the ICS stuff and I can’t figure out where the
> returned file list is put or access when I issue a LIST of LS
> command.  Checked the source header and FAQ first, but (unless I
> missed it) I can't see anything on the subject other than "the list
> is placed in a local file". Where? 

Check the FtpsTst demo, there's a property LocalFileName  
search for string  "TEMP_FILE_NAME".

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html


> 
> Thanks,
> 
> Ian Thompson
> 
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.488 / Virus Database: 269.14.10/1070 - Release Date:
> 14/10/2007 09:22
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Re: [twsocket] TWSocketThrdServer

2007-10-15 Thread Arno Garrels
Ana Onarres wrote:
> Hello,
> 
> I want to create a server socket that accepts connections of several
> clients. Every client, first, send data to server. This data are
> validated for server and then the server sends data to the client.  
> 
> What difference is between to use TWSocketThrdServer and use
> TWSocketServer with ClientThread? Which is better for me?

With TWSocketServer you do not need client threads, TWSocketServer
can easily serve hundreds of concurrent clients in a single
thread.  That includes fast sending and receiving data to/from
multiple connected clients. It's because ICS uses non-blocking winsock
API. You need threads only for lengthy, blocking tasks such as a
DB query etc. For instance when a client requests data from a DB
you start a thread that executes the query, when the thread has finished
sent the result to the client.
ICS works event-driven, means that most methods return immediately
before they are finished, later when they finished another event is
triggered where you take further action.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

  
> 
> Thanks for your attention.
> 
> Regards.
> Anne.
> 
> _
> Express yourself instantly with MSN Messenger! Download today it's
> FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] A TFtpCli application performance question

2007-10-15 Thread Arno Garrels
Hi,

I've written a FTP-uploader without taking much care of speed issues.
It uploads 17000 files with total size of 830 MB in 56 mins in my
100 MBit/s LAN (logging each FTP-command).

What do you think, is that:
a) Poor
b) OK
c) Fast

I currently don't have any idea. 

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html





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


Re: [twsocket] A TFtpCli application performance question

2007-10-15 Thread Arno Garrels
Francois PIETTE wrote:
>> I've written a FTP-uploader without taking much care of speed issues.
>> It uploads 17000 files with total size of 830 MB in 56 mins in my
>> 100 MBit/s LAN (logging each FTP-command).
>> 
>> What do you think, is that:
>> a) Poor
>> b) OK
>> c) Fast
>> 
>> I currently don't have any idea.
> 
> Actually, this is a lot of small files (48KB mean size).
> Speed is roughly 2 Mbps which is low for a 100 Mbps.

Oha, as I read between the lines, I have to rework my code :(
 
> Do you establish a new connection for each file ?

A new data connection is established for each file, the control
connection however is not re-established.

> What about directory changes ?

The directory tree is created at the remote end if not yet present.

> Is it a single FTP connection for all files sequentially ?

Yes, stupidly one file after the other (that shall not be
changed, since multiple instances shall be reserved for sendind to
different destinations the same files concurrently).

> Is it a single destination server ?

Yes, Serv-U was the test server.

> What about authentication ? If you do a new connection for each file,
> autenthication alone can be time consuming.

There's only one session.

> What if you transfert the same data volume (830MB) in a single file ?

Needs testing, but from memory, LAN speed looked quite OK. 

> Same question if you break into 4 large file and use 4 instances of
> your program ?

That would most likely speed up things, currently CPU use is only at
0-15% at the client side.


--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html


> 
> --
> [EMAIL PROTECTED]
> The author of the freeware multi-tier middleware MidWare
> The author of the freeware Internet Component Suite (ICS)
> http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] A TFtpCli application performance question

2007-10-16 Thread Arno Garrels
Francois Piette wrote:
>>> Actually, this is a lot of small files (48KB mean size).
>>> Speed is roughly 2 Mbps which is low for a 100 Mbps.
> 
>> Oha, as I read between the lines, I have to rework my code :(
> 
> You never reach 100 Mbps which is faster than many disks. Once you
> have large data size, you overflow the cache memory and work at the
> speed of the disk.

Just tested uploading a single 2 GB file at 44 Mbits/s, CPU use went
down when server was writing to disk heavily so most likely real line
speed is even better.
But the limit of 2 Mbits/s with plenty of small files persists and
there seems to be no way around except by using multiple instances.

Another bottleneck may be logging. Each log message, FTP request,
response, and other stuff has to be written to log files and must
be sent to a GUI application that controls the uploader service via
a socket connection. I do that by Move() the log message into a newly
allocated piece of memory, and PostMessage() the memory address to
another thread (the Com-Thread) running TWSocketServer to communicate
with the GUI. The Com-Thread the writes to the log files and if a GUI
is connected TWSocketClient sends the log string, afterwards memory
is released. That works without a leak since FastMM is used, however
there are approximately 8 log lines thus 8 calls to GetMem() per
uploaded file. If this design was realy a problem, do you know a 
faster way?

>
> There are also differences if you use a real server (hardware and
> software) than a simple desktop to do your tests.

Both are simple desktops.
 
> Sometimes there are bandwidth limitation setup in server, routers,
> switches,...

That's not the case here.
 
> And of course bad cabling can slow down things. Use "netstat -e" to
> see you netwrok card statistics. rejected packets and errors should
> be zero. 

Fortunately both are zero.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html



> --
> [EMAIL PROTECTED]
> Author of ICS (Internet Component Suite, freeware)
> Author of MidWare (Multi-tier framework, freeware)
> http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] A TFtpCli application performance question

2007-10-16 Thread Arno Garrels
Tobias Rapp wrote:
>>> Actually, this is a lot of small files (48KB mean size).
>>> Speed is roughly 2 Mbps which is low for a 100 Mbps.
>> 
>> Oha, as I read between the lines, I have to rework my code :(
> 
> Also do not forget to play with the BufSize and SocketSndBufSize
> settings on tWSocket. I made good experiences when using values of
> ~1MB. The default value for both settings is very low (at least for
> file delivery purposes).

But upload of large files is pretty fast, the problem seems to be with
plenty of small files only, see my previous message.

> 
> /Tobias
> 
> 
> --
> NOA Audio Solutions Vertriebsges. m.b.H.   Tel: +43-1-5452700
> Johannagasse 42/4  Fax: +43-1-545270014
> A - 1050 Wien  Www: http://www.noa-
> audio.com 
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] how 2 set up a root folder fot FTP server

2007-10-17 Thread Arno Garrels
Poman wrote:
> hi, i just can't figure out, how 2 set a root folder (only
> directories under the server's root folder can be reached)
> TFtpServer component 

The client home directory should be set in event OnAuthenticate:
Client.HomeDir   := 'C:\FtpRoot\';
Client.Directory := Client.HomeDir; // Set current directory as well

Note that the path MUST include a trailing backslash.
In order to allow directory changes to a level beyond
HomeDir look at either global option ftpsCdUpHome or 
client-option ftpCdUpHome.

I recommend to use V6 since it provides options ftpsHidePhysicalPath
and ftpHidePhysicalPath and also fixes some security issues related
to directory changes.  

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html



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


Re: [twsocket] ICS v6 migration considerations

2007-10-17 Thread Arno Garrels
DZ-Jay wrote:
> Hello:
> We have a few applications using ICS v5, mostly written in D2006/7,
> but some in D5. 

D5 won't work, ICS V6 is specified for D7 and better.

> I would like to move to ICS v6, since that seems to
> be where major development is taking place, and also because I would
> like to take advantage of its new hidden window architecture.
> However, I'm concerned about how this is going to impact our
> applications (they are not very many right now).  In particular, we
> are using TWSocket, TWSocketServer, SmtpCli, and FtpCli components.
> 
> Are there any specific issues that I should be aware of before
> attempting the switch?  I understand that the interface did not
> change, but will the new internal model affect anything in the rest
> of the application environment? 

Basically you just have to change the library path from V5 to the 
V6 directory and rename the ICS units in your uses clauses, just prepend 
"OverbyteIcs".
If you have overridden any of the V5 WndProc-functions a little bit
more work is necessary. Message-IDs posted to the hidden window(s)
are no longer simple contants but variables that must be registered.
When you register a new message-id for use with the component's window
three methods MUST be overridden, see sample below:

function TFoo.MsgHandlersCount : Integer;
begin
Result := 1 + inherited MsgHandlersCount;
end;

procedure TFoo.AllocateMsgHandlers;
begin
inherited AllocateMsgHandlers;
FMsg_WM_FOO := FWndHandler.AllocateMsgHandler(Self);
end;

procedure TFoo.FreeMsgHandlers;
begin
if Assigned(FWndHandler) then
FWndHandler.UnregisterMessage(FMsg_WM_FOO);
inherited FreeMsgHandlers;
end;


> Is there a possibility of having both
> versions concurrently installed?

To avoid confusion I've always only one version installed and active
in the IDE at the same time.   
When you toggle the packages also don't forget to change the library
path entry to point to the correct directory.

> 
> I would also like to hear from users of ICS v6 and whether they find
> it stable in their production software.

I think it can be considered as stable as V5, brand new features however
may still be beta of course.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html



 
> Thanks,
> dZ.
> 
> --
> [localhost] # chown -R us /usr/home/*/base
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] ICS v6 migration considerations

2007-10-17 Thread Arno Garrels
DZ-Jay wrote:
> On Oct 17, 2007, at 06:52, Arno Garrels wrote:
>> function TFoo.MsgHandlersCount : Integer;
>> begin
>> Result := 1 + inherited MsgHandlersCount;
>> end;
>> 
>> procedure TFoo.AllocateMsgHandlers;
>> begin
>> inherited AllocateMsgHandlers;
>> FMsg_WM_FOO := FWndHandler.AllocateMsgHandler(Self);
>> end;
>> 
>> procedure TFoo.FreeMsgHandlers;
>> begin
>> if Assigned(FWndHandler) then
>> FWndHandler.UnregisterMessage(FMsg_WM_FOO);
>> inherited FreeMsgHandlers;
>> end;
> 
> This only to register new custom messages, right? 

Correct, never send/post any _custom_ messages to V6 component
windows except they have been registered like that before.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html





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


Re: [twsocket] FTP Client in a separate thread

2007-10-17 Thread Arno Garrels
Tobias Giesen wrote:
> 
> My problem is that this separate thread makes my application very
> unresponsive. The main application thread seems to be almost totally
> blocked and responds to messages, such as moving or drawing the
> main window, only after big delays.

How is option ftpWaitUsingSleep set? Can you try to change this
to either True or False? I've no experience with the sync-methods
since I'm using async methods, in worker threads successfully as
well. If that doesn't change anything you could try to lower 
thread's priority, just an idea.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html



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


Re: [twsocket] FTP Client in a separate thread

2007-10-17 Thread Arno Garrels
Tobias Giesen wrote:
> Everything happens in the thread,

Just to clear this up, you have to create the TFtpClient
instance method Execute of TThread. Otherwise it won't
realy run in the thread.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html


 

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


Re: [twsocket] TWSocketServer Client.Shutdown(1) does not destroy it

2007-10-17 Thread Arno Garrels
[EMAIL PROTECTED] wrote:
> Here's a sample of my code:
> 
> Procedure TMyServer.ClientDataAvailable(Sender:
> TObject; Error: Word);
> Begin
>   With (Sender As TMyClient) Do Begin
> If (SomethingBadHappened) Then Begin
>   SendLine('Error!');
>   Shutdown(1);
> End;
>   End;
> End;

Your code does not guarantee that all data will be sent
to the client. Make sure that ShutDown() is called after
all data has been delivered to winsock. Something like
that:

Procedure TMyServer.ClientDataAvailable(Sender:
TObject; Error: Word);
Begin
  With (Sender As TMyClient) Do Begin
If (SomethingBadHappened) Then Begin
   OnDataSent := ClientDataSent;   
   SendLine('Error!');
End;
  End;
End;

procedure TMyServer.ClientDataSent(Sender: TObject; ErrCode: Word);
begin
TWSocket(Sender).OnDataSent := nil; 
TWSocket(Sender).Shutdown(1);
end;

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html




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


Re: [twsocket] FTP Client in a separate thread

2007-10-18 Thread Arno Garrels
Tobias Giesen wrote:
> Hello,
> 
> thanks for the suggestions, Arno and Francois!
> 
> I will try it using ASync calls. I tried ftpWaitUsingSleep but it does
> not make any difference.
> 
> But the problem is not a CPU concurrency problem. It is much worse.
> The main thread calls PeekMessage (in TApplication.ProcessMessage) and
> Windows does not return from this call for a minute or so!! How on
> earth can that be ... the worker thread's priority is already tpLower.

Strange.

> 
> And everything works fine as long as I copy files locally, but as
> soon as I use FTP or HTTP or even SSH with any library (ICS, Indy,
> SecureBlackBox, Clever Internet Suite) the main process stalls.

So are you saying that it's not a problem related to ICS only?
Do you see similar (strange delays or high CPU use) with IE or any
other internet application as well?

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

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


Re: [twsocket] TWSocketServer Client.Shutdown(1) does not destroy it

2007-10-18 Thread Arno Garrels
DZ-Jay wrote:
> On Oct 18, 2007, at 02:35, Arno Garrels wrote:
> 
>> Your code does not guarantee that all data will be sent
>> to the client. Make sure that ShutDown() is called after
>> all data has been delivered to winsock. Something like
>> that:
> 
> Thanks Arno.  But now I'm confused:  It was because I was told to call
> Shutdown(1) that I used it when closing the connection.
> I was told on this list that that's what I should do to ensure that the 
> closing
> message data is delivered before closing the connection.  Was this not
> accurate?

That was correct, only Shutdown() should be called after all data that might
still be waiting for delivery in the _component_ send buffer has been delivered
to the underlaying socket.
When you call any of the send-functions data is first copied into the internal
send buffer of the component, real sending the happens in the background.
So real sending may be delayed depending on how much you sent or on how many 
data
is still hanging in the _component_ send buffer.
ShutDown(1) only guarantees that any data delivered to the underlaying socket 
yet
will be sent to the client, it does not guarantee component's send buffer is
fully sent and empty, so calling ShutDown(1) in event OnDataSent is an ideal
place. Btw: If for some reason TWSocket would try so send something after
Shutdown() has been called a SocketException is raised.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html




  
  

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


Re: [twsocket] Keeping a Responsive UI during THTTPCli Download

2007-11-12 Thread Arno Garrels
Robert Chafer wrote:
> If it is asynchronous ... isn't a UI that responds the default?

Usually it is, however there is a small difference between GUI
messages being queued in the message queue and notification
messages from winsock being sent to the hidden ICS window directly.
If you transfer on very fast lines it may happen that there's no
time left to retrieve and process messages from the message queue
if those notifications from winsock come in fast enough.
WM_PAINT and the like are queued and so have less piority. That's
why the OP saw an improvement calling ProcessMessages from a
timer event, timer messages are not queued as well. Be aware that
calling ProcessMessages from any ICS event handler can lead to
strange and buggy component behaviour.
Never ever call the message pump from component's event handlers,
except you know very well what you are doing.

--
Arno Garrels


> 
> On Sun, 11 Nov 2007 09:25:31 -0800, you wrote:
> 
>>  I have a simple program that downloads a large file using the HTTP
>> Client.  How would one keep the user interface responsive during a
>> long asynchronous  download?
>> 
>>  I have tried a number of things and finally ended up adding a timer
>> with an  Application.ProcessMessages in it. Is there a better way to
>> keep the UI  responsive for button clicks and such?
>> 
>>  Thanks,
>>  --
>>  Johnnie Norsworthy
> --
> 
> Robert Chafer
> Silverfrost Limited
> 
> Office: +44 (0)161 795 1980
> Email:  [EMAIL PROTECTED]
> Web:http://www.silverfrost.com
> 
> The contents of this message and any attachments to it are
> confidential and may be legally privileged. If you have received this
> message in error you should delete it from your system immediately
> and advise the sender. To any recipient of this message within
> Silverfrost, unless otherwise stated, you should consider this
> message and attachments as Silverfrost confidential. 
> 
> Silverfrost Limited is registered in England, Company Number 3447013,
> 4 Coulsden Drive, Manchester, M9 6AP, United Kingdom. 
-- 
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] [OT] Writing Vista applications using Delphi

2007-11-13 Thread Arno Garrels
Dod wrote:
> Hello Hoby,
> 
> I use the "good old" Delphi 2007 on Vista ...fine...

And I installed both "good old" Delphi 7 as well as Delphi 2007
on Vista. Though my day to day box still remains W2K so I haven't
used one of those installs for working on real products yet. Should
be no problem to install 2006 on Vista as well. Either turn off UAC
or run the BDS-Process as Admin, also turn off hardware DEP. 

--
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] One Time Passwords

2007-11-14 Thread Arno Garrels
Angus Robertson - Magenta Systems Ltd wrote:
 
> I've got opt-md5 working in the ICS FTP client (and shortly the FTP
> server), but opt-md4 and opt-sha1 are not generating the expected
> results. 

Just a little test with MD4, Count 0 gave me the expected result:  

MD4Init(Md4Ctx);
Md4Update(Md4Ctx, 'testThis is a test.', 19);
Md4Final(Md4Ctx, MD4Digest);

//* Fold the 128 bit result to 64 bits */
for I := 0 to  7 do
   MD4Digest[I] :=  MD4Digest[I] xor MD4Digest[I + 8];

for I := 0 to 7 do
   S := S + IntToHex(MD4Digest[I], 2) + ' '; 


However I wonder how you translate the stuff below?

 /*
  * copy the resulting 64 bits to the result buffer in little endian
  * fashion (analogous to the way MD4Final() and MD5Final() do).
  */
 for (i = 0, j = 0; j < 8; i++, j += 4)
 {
 result[j]   = (unsigned char)(sha.digest[i] & 0xff);
 result[j+1] = (unsigned char)((sha.digest[i] >> 8) & 0xff);
 result[j+2] = (unsigned char)((sha.digest[i] >> 16) & 0xff);
 result[j+3] = (unsigned char)((sha.digest[i] >> 24) & 0xff);
 }



-- 
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] Need help with Active Directory user path permissions

2007-11-15 Thread Arno Garrels
Fastream Technologies wrote:
> Hello,
> 
> I wonder if it is possible to learn what folders a particular AD user
> has read/write permissions? 
> I need to learn these paths because I am
> coding an ICS-based FTP server and want to display outside-or-root
> folders as virtual folders. I hope you get what I mean and help.

AFAIK, that's impossible. I think you have to maintain a custom list of
each user's folder mapping. 

--

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] Need help with Active Directory user path permissions

2007-11-15 Thread Arno Garrels
Fastream Technologies wrote:
> Ok, another language problem... What do you mean with "maintain a
> custom list of
> each user's folder mapping"? I know that I need to modify folder
> listings but to do that I need to know which folders are existing
> outside of root.

When the server admin sets up the folders of an account you store
this configuration, including the mapping real path <=> virtual path.  

 
> 
> Regards,
> 
> SZ
> 
> 
> On 11/15/07, Arno Garrels <[EMAIL PROTECTED]> wrote:
>> 
>> Fastream Technologies wrote:
>>> Hello,
>>> 
>>> I wonder if it is possible to learn what folders a particular AD
>>> user has read/write permissions?
>>> I need to learn these paths because I am
>>> coding an ICS-based FTP server and want to display outside-or-root
>>> folders as virtual folders. I hope you get what I mean and help.
>> 
>> AFAIK, that's impossible. I think you have to maintain a custom list
>> of each user's folder mapping.
>> 
>> --
>> 
>> 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] Receive vs ReceiveStr, Speed vs Complexity

2007-11-17 Thread Arno Garrels
Shawn Jones wrote:
> I have been happily enjoying the simplicity of using ReceiveStr. 
> However I now have a requirement to send much larger amounts of data.
> I have profiled my app and have concluded that the largest bottleneck
> ( > 50%) is ReceiveStr.

I think it's the definition of "bottleneck". If your app. does nothing
but transfer data, the bottleneck was sure the transfer function. 

> 
> My app now needs to send a large number of records.  Currently, I'm
> converting each record to a string and calling SendStr and the client
> is using ReceiveStr.
> 
> Is the speed improvement potential worth the added complexity to
> covert my app from using SendStr and ReceiveStr to Send and Receive?

Francois already answered that.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html




> 
> If yes, any pointers on how to proceed?
> 
> thanks,
> shawn
-- 
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] FTP Failure

2007-11-24 Thread Arno Garrels
David Bridges wrote:
> It always works
> at my site but some clients have this problem.  

>> PORT 192,168,1,91,11,164
> < 200 PORT command successful.

Looks like a router problem to me.
The client sends the local, private IP and port in the Port
command, however the (NAT) router isn't smart enough to change this
to the current public IP. I guess the user must either buy a smarter
router or try passive mode (if the server allows it).

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html




 


-- 
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] I need some help understanding TWsocket states

2007-11-26 Thread Arno Garrels
Hello Pete,

The states are not that important, but the events are.
Check this link: http://wiki.overbyte.be/wiki/index.php/Asynchronous_Paradigm
and ask your questions here if it doesn't answer your question.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html


Pete Williams wrote:
> Hello again
> 
> I'm trying to write a very simple client/server socket application
> using TWSocket. However, I think I may not understand the use of
> states correctly. 
> 
> What I want is for the client to connect to the server, send some
> data, and then disconnect. If it has more data to send, I want it to
> connect again and repeat the process.
> 
> Here's what is happening at the moment. The client can connect to the
> server and successfully send as much data as it chooses. However, once
> it disconnects it can't reconnect.
> 
> The code on the client is broadly thus (using  a pseudo code):
> 
> if myclient.state <> wsConnected then
> begin
> myclient.connect;
> loop for 5 seconds begin
>myclient.processMessages;
>if myclient.state = wsConnected then
>begin
>   lbConnected := TRUE:
>   break;
>end;
> end loop;
> end else
> lbConnected := TRUE;
> 
> if lbConnected then
> myclient.sendstr(thedatastring);
> 
> myclient.close();
> 
> On the server, this is what I have:
> 
> myserver.OnsessionAvailable
> begin
> myserversocket.dup(myserversocket.accept());
> end;
> 
> I'm also handling the OnDataAvailable event, and this works fine - but
> only the first time (or at least until the client disconnects).
> 
> I've tried recalling listen() in the OnSessionClosed event, but it
> does nothing.
> 
> The state of the client on the 2nd attempt to reconnect remains at
> closed. 
> 
> If anyone can point me in the right direction I'd be grateful. Maybe I
> need some form of clean-up on the server after the disconnect?
> 
> Cheers,
-- 
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] Delphi 4

2007-11-27 Thread Arno Garrels
troppo gigio wrote:
> There will be any SSL for delphi 4 ??

ICS-SSL-V5 requires Delphi 5 and
ICS-SSL-V6 requires Delphi 7. 
However most likely it were not much work to make ICS-SSL-V5
compile with Delphi 4 as well.  

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html




-- 
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] Fwd: Re: parameter error in twsocket w/d2

2007-11-27 Thread Arno Garrels
> the unit. Still the same 'actual and formal var parameter must be
> identical' error at Status := WSocket_WSAIoctl(FHSocket,
> SIO_KEEPALIVE_VALS,

It's just a vague guess, I don't have D2 avalable, you may
try changing:

procedure TCustomWSocket.SetKeepAliveOption;
var
..
{$IFDEF DELPHI3}
BytesReturned : DWORD;
{$ELSE}
BytesReturned : Cardinal;
{$ENDIF}
..

To:
procedure TCustomWSocket.SetKeepAliveOption;
var
..
BytesReturned : DWORD;
..

Does that help?

--
Arno Garrels


[EMAIL PROTECTED] wrote:
> Quoting Francois Piette <[EMAIL PROTECTED]>:
> 
>>> I am using Delphi 2 c/s. I also got the "cannot assign to a read-
>>> only property" error when installing cslogger.pas. I found the
>>> following fix in one of the threads:
>> 
>> Just add the compiler option "writable constant" in the project
>> options (Or {$J+} in the offending source code if memory serve me
>> well). 
> 
> I tried adding {$J+} to the block and when that made no difference, to
> the unit. Still the same 'actual and formal var parameter must be
> identical' error at Status := WSocket_WSAIoctl(FHSocket,
> SIO_KEEPALIVE_VALS,
>   @KeepAliveIn,  SizeOf(KeepAliveIn),
>   @KeepAliveOut, SizeOf(KeepAliveOut),
>   BytesReturned, nil, nil);
> 
> There is no "writable constant" compiler option in my d2. There is an
> 'Assignable typed constants' {$J}, however this was already checked.
> 
> 
>> 
>>> Any suggestions?
>> 
>> Update your Delphi, preferably to the current version (Delphi 2007).
>> 
>> Contribute to the SSL Effort. Visit
>> http://www.overbyte.be/eng/ssl.html --
>> [EMAIL PROTECTED]
>> Author of ICS (Internet Component Suite, freeware)
>> Author of MidWare (Multi-tier framework, freeware)
>> http://www.overbyte.be
>> 
>> 
>> - Original Message -
>> From: <[EMAIL PROTECTED]>
>> To: 
>> Sent: Monday, November 26, 2007 11:01 PM
>> Subject: [twsocket] parameter error in twsocket w/d2
>> 
>> 
>>> I am using Delphi 2 c/s. I also got the "cannot assign to a read-
>>> only property" error when installing cslogger.pas. I found the
>>> following fix in one of the threads:
>>> 
>>> "You can remove the offending line and /ADD/ the following two
>>> lines at the beginning of InternalOpenLogFile, just after
>>> InternalCloseLogFile: 
>>> 
>>>  if (FLogFileOption = lfoOverwrite) and
>>> FileExists(FLogFileName) then  DeleteFile(FLogFileName);"
>>> 
>>> Now I get a fatal 'actual and formal var parameter must be
>>> identical' error in wsocket.pas at line:
>>> 
>>> Status := WSocket_WSAIoctl(FHSocket,  SIO_KEEPALIVE_VALS,
>>> @KeepAliveIn,  SizeOf(KeepAliveIn),
>>> @KeepAliveOut, SizeOf(KeepAliveOut),
>>> BytesReturned, nil, nil);
>>> 
>>> Any suggestions?
>>> 
>>> --
>>> 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 
>> 
>> --
>> 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
>> 
> 
> 
> 
> 
> - End forwarded message -
-- 
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] Fwd: Re: parameter error in twsocket w/d2

2007-11-28 Thread Arno Garrels
[EMAIL PROTECTED] wrote:

> That's it! I just changed {$IFDEF DELPHI3} to {$IFDEF DELPHI2} and it
> compiled.

Fine, so most likely in both D2 and D3 a DWORD is mapped to a signed 
longint. Since Delph 4 however it's a true unsigned 32 bit integer.
If you chang the conditional to "{$IFDEF DELPHI2}" it won't compile
in Delphi 3 anymore, I think you should simply remove the conditional. 

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html




> Quoting Arno Garrels <[EMAIL PROTECTED]>:
> 
>>> the unit. Still the same 'actual and formal var parameter must be
>>> identical' error at Status := WSocket_WSAIoctl(FHSocket,
>>> SIO_KEEPALIVE_VALS,
>> 
>> It's just a vague guess, I don't have D2 avalable, you may
>> try changing:
>> 
>> procedure TCustomWSocket.SetKeepAliveOption;
>> var
>> ..
>> {$IFDEF DELPHI3}
>> BytesReturned : DWORD;
>> {$ELSE}
>> BytesReturned : Cardinal;
>> {$ENDIF}
>> ..
>> 
>> To:
>> procedure TCustomWSocket.SetKeepAliveOption;
>> var
>> ..
>> BytesReturned : DWORD;
>> ..
>> 
>> Does that help?
>> 
>> --
>> Arno Garrels
> 
> That's it! I just changed {$IFDEF DELPHI3} to {$IFDEF DELPHI2} and it
> compiled.
> Thanks bud!
> 
>> [EMAIL PROTECTED] wrote:
>>> Quoting Francois Piette <[EMAIL PROTECTED]>:
>>> 
>>>>> I am using Delphi 2 c/s. I also got the "cannot assign to a read-
>>>>> only property" error when installing cslogger.pas. I found the
>>>>> following fix in one of the threads:
>>>> 
>>>> Just add the compiler option "writable constant" in the project
>>>> options (Or {$J+} in the offending source code if memory serve me
>>>> well).
>>> 
>>> I tried adding {$J+} to the block and when that made no difference,
>>> to the unit. Still the same 'actual and formal var parameter must be
>>> identical' error at Status := WSocket_WSAIoctl(FHSocket,
>>> SIO_KEEPALIVE_VALS,
>>>   @KeepAliveIn, 
>>> SizeOf(KeepAliveIn),  
>>> @KeepAliveOut, SizeOf(KeepAliveOut),   
>>> BytesReturned, nil, nil); 
>>> 
>>> There is no "writable constant" compiler option in my d2. There is
>>> an 'Assignable typed constants' {$J}, however this was already
>>> checked. 
>>> 
>>> 
>>>> 
>>>>> Any suggestions?
>>>> 
>>>> Update your Delphi, preferably to the current version (Delphi
>>>> 2007). 
>>>> 
>>>> Contribute to the SSL Effort. Visit
>>>> http://www.overbyte.be/eng/ssl.html --
>>>> [EMAIL PROTECTED]
>>>> Author of ICS (Internet Component Suite, freeware)
>>>> Author of MidWare (Multi-tier framework, freeware)
>>>> http://www.overbyte.be
>>>> 
>>>> 
>>>> - Original Message -
>>>> From: <[EMAIL PROTECTED]>
>>>> To: 
>>>> Sent: Monday, November 26, 2007 11:01 PM
>>>> Subject: [twsocket] parameter error in twsocket w/d2
>>>> 
>>>> 
>>>>> I am using Delphi 2 c/s. I also got the "cannot assign to a read-
>>>>> only property" error when installing cslogger.pas. I found the
>>>>> following fix in one of the threads:
>>>>> 
>>>>> "You can remove the offending line and /ADD/ the following two
>>>>> lines at the beginning of InternalOpenLogFile, just after
>>>>> InternalCloseLogFile:
>>>>> 
>>>>>  if (FLogFileOption = lfoOverwrite) and
>>>>> FileExists(FLogFileName) then  DeleteFile(FLogFileName);"
>>>>> 
>>>>> Now I get a fatal 'actual and formal var parameter must be
>>>>> identical' error in wsocket.pas at line:
>>>>> 
>>>>> Status := WSocket_WSAIoctl(FHSocket,  SIO_KEEPALIVE_VALS,
>>>>> @KeepAliveIn, 
>>>>> SizeOf(KeepAliveIn),
>>>>> @KeepAliveOut, SizeOf(KeepAliveOut), 
>>>>> BytesReturned, nil, nil); 
>>>>> 
>>>>> Any suggestions?
>>>>> 
>>>>> --
>>>>> 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
>>>> 
>>>> --
>>>> 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 
>>>> 
>>> 
>>> 
>>> 
>>> 
>>> - End forwarded message -
>> --
>> 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
-- 
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] turbo delphi.

2007-11-28 Thread Arno Garrels
Robert W Harris wrote:
> hey just woundering.
> will ICS work with turbo delphi?

Yes, the Turbos basically are BDS2006 with just the Delphi personality,
however the free Version doesn't allow components to be installed in the
IDE, instead you have to create the ICS-Objects at runtime.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html



  
-- 
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] TWSocketServer and backlog

2007-11-28 Thread Arno Garrels
Paul wrote:
> I always use 500, no problems yet

But the ListenbacklogQueue is limited in size depending
on the OS (cannot recall the values, however it's far less
then 500, AFAIR). The more "blocking" the server behaves the
earlier you get 10061 back from a connect. Simple test is with
TcpSrv Demo, with logging to the memo enabled I get the first
error 10061 after 100-200 connects (10ms intervals). Turning off
logging to memo establishes several thousand connections without
any error easily.

--

Arno Garrels
   

> 
> Paul
> 
> 
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: 
> Sent: Wednesday, November 28, 2007 6:27 PM
> Subject: [twsocket] TWSocketServer and backlog
> 
> 
>> Hello:
>>While stress-testing my application, I noticed
>> that I am able to send substantially many more
>> connections in the time it takes the TWSocketServer
>> to handle the incomming requests, causing the default
>> backlog to fill up quickly.  Obviously, I can
>> increase the number, but seeing that the default is 5
>> (which seems rather low to me), I'm thinking that
>> perhaps there may be a concern in setting this too high.
>> 
>>Does anybody know what I should take into
>> consideration before changing this value, and if
>> there are any concerns with it being too high?
>> 
>>Thanks,
>>-dZ.
>> 
>> --
>> 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
-- 
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] I need some help understanding TWsocket states

2007-11-28 Thread Arno Garrels
Pete Williams wrote:
> My client wants to sometimes connect to the server, send a few lines
> of data, and then disconnect.
> 
> When I want to send data this is what I do
> 
> procedure sendData(asMessage: string);
> begin
> mystringlist.add(asMessage);
> if mytwsocket.state <> wsConnected then
> begin
>mytwsocket.addr := '127.0.0.1'; // client and server are on
> same machine
>mytwsocket.port := '17072';
>mytwsocket.connect();
> end;
> end;

Next event that fires will be OnSessionConnected.
in OnSessionConnected you can safly send data. 

> 
> Then I have handlers for OnSessionAvailable 

Connecting TWSockets will never fire this event,
instead assign OnSessionConnected at the client-side.
OnSessionAvailable triggers on listening TWSockets only.


> and OnDataSent.

> OnSessionAvailable doesn't seem to get called ever.

OnDataSent is usefull to send large data in smaller chunks.
It's always called when the internal send buffer became empty.

--
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] I need some help understanding TWsocket states

2007-11-28 Thread Arno Garrels
[EMAIL PROTECTED] wrote:
> Hello:
>This may sound stupid, but could you verify that
> the OnSessionAvailable event is actually wired
> (assigned to the property)?  It seems strange that it
> is not called, yet OnDataSent is.

OnSessionAvailable is called only on listening TWSockets,
as I read the post it deals with a client (connecting party).

--
Arno Garrels

> 
>Also, what happens when you try to send a second
> time (or does it even try)?  Do you get a "Component
> already connected" error or something like that?
> 
>If your burst messages are short as your example
> implies, then there is really no reason to do this on
> a separate thread; it will actually be slower to
> spawn a new thread and execute it than to just
> re-connect and call SendStr.
> 
>  -dZ.
> 
> 
>> --- Original Message ---
>>> From: Pete Williams[mailto:[EMAIL PROTECTED]
>> Sent: 11/28/2007 1:49:27 PM
>> To  : twsocket@elists.org
>> Cc  :
>> Subject : RE: Re: [twsocket] I need some help understanding TWsocket
>> states 
>> 
>  >Thank you to the two people who replied. I got
> really good advice which
> I followed and this seems to have given me a working
> server, but I still
> have client problems.
> 
> - I created a message-pump in a distinct thread for
> the DLL server, as
> advised.
> - Both client and server were changed to async
> programming style, and
> this worked for the server.
> 
> I have another problem though, which seems stange,
> and may be related to
> timing (or something).
> 
> My client wants to sometimes connect to the server,
> send a few lines of
> data, and then disconnect.
> 
> When I want to send data this is what I do
> 
> procedure sendData(asMessage: string);
> begin
> mystringlist.add(asMessage);
> if mytwsocket.state <> wsConnected then
> begin
>mytwsocket.addr := '127.0.0.1'; // client and
> server are on same
> machine
>mytwsocket.port := '17072';
>mytwsocket.connect();
> end;
> end;
> 
> Then I have handlers for OnSessionAvailable and
> OnDataSent.
> OnSessionAvailable doesn't seem to get called ever.
> 
> In OnDataSent I do this
> 
> begin
> if mystringlist.count > 0 then
> begin
>mytwsocket.sendStr(mystringlist[0]+#$D#$A);
>mystringlist.delete(0); // we've sent this one
> end else
> begin
>mytwsocket.close(); // no more data to send,
> so close
> end;
> end;
> 
> Here's what I've observed. The client can send once,
> and that's it. I
> can't send twice. However, if I put a breakpoint at
> the end of the
> function that connects to the server,it works -
> almost like there is
> some kind of timing issue.
> 
> I'm working on Windows 2003.
> 
> Should I use threads for my clients as well? Any
> advice is greatly received.
> 
> 
> Wilfried Mestdagh wrote:
>> Hello Pete,
>> 
>> 
>>> if myclient.state <> wsConnected then
>>> begin
>>> myclient.connect;
>>> loop for 5 seconds begin
>>> 
>> 
>> You have to think async. TWSocket uses events.
> think on events as a
>> OnClick event of a butten. You don't write loops to wait until a user
>> click a button. So you have to change to:
>> 
>>MyClient.Connect; // that's all
>> 
>> and in the OnSessionAvailable event you start do
>>TWSocket(Sender).sendstr(thedatastring);
>> 
>> 
>>>myclient.processMessages;
>>> 
>> 
>> General a very bad idea to call the message pump
> yourself.
>> 
>> 
>>> myclient.close();
>>> 
>> 
>> If your client has send all the data then you still
> dont know if the
>> other end has received an handled the data. if you
> design your proto
>> yourself then the receiver can close. if  you dont
> then call
>> ShutDown(1);
>> 
>> 
>>> myserver.OnsessionAvailable
>>> begin
>>> myserversocket.dup(myserversocket.accept());
>>> end;
>>> 
>> 
>> Better to use TWSocketSer4ver.
>> 
>> ---
>> Rgds, Wilfried [TeamICS]
>>  http://www.overbyte.be/eng/overbyte/teamics.html
>>  http://www.mestdagh.biz
>> 
>> Monday, November 26, 2007, 18:58, Pete Williams wrote:
>> 
>> 
>>> Hello again
>>> 
>> 
>> 
>>> I'm trying to write a very simple client/server socket application
>>> using TWSocket. However, I thin

Re: [twsocket] upgrading

2007-11-28 Thread Arno Garrels
[EMAIL PROTECTED] wrote:
>> Update your Delphi, preferably to the current version (Delphi 2007).
> .. and what kind of nightmare can I expect migrating over 6mb of d2
> code to d7?

The longer you wait upgrading to a current version the nightmare will
last longer ;-)

--
Arno Garrels  

> 
> Contribute to the SSL Effort. Visit
> http://www.overbyte.be/eng/ssl.html --
> [EMAIL PROTECTED]
> Author of ICS (Internet Component Suite, freeware)
> Author of MidWare (Multi-tier framework, freeware)
> http://www.overbyte.be
> 
> 
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: 
> Sent: Monday, November 26, 2007 11:01 PM
> Subject: [twsocket] parameter error in twsocket w/d2> I am using
> Delphi 2 c/s. I also got the "cannot assign to a read-only
>> property" error when installing cslogger.pas. I found the following
>> fix in one of the threads:
>> 
>> "You can remove the offending line and /ADD/ the following two lines
>> at 
> the
> 
> [Hide Quoted Text]
>> beginning of InternalOpenLogFile, just after InternalCloseLogFile:
>> 
>>  if (FLogFileOption = lfoOverwrite) and FileExists(FLogFileName)
>> then  DeleteFile(FLogFileName);"
>> 
>> Now I get a fatal 'actual and formal var parameter must be identical'
>> error in wsocket.pas at line:
>> 
>> Status := WSocket_WSAIoctl(FHSocket,  SIO_KEEPALIVE_VALS,
>> @KeepAliveIn,  SizeOf(KeepAliveIn),
>> @KeepAliveOut, SizeOf(KeepAliveOut),
>> BytesReturned, nil, nil);
>> 
>> Any suggestions?
>> 
>> --
>> 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
> 
> 
> --
> 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
-- 
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] I need some help understanding TWsocket states

2007-11-28 Thread Arno Garrels
[EMAIL PROTECTED] wrote:
> Its nice to have a mailing list where you can get
> many people addressing the same questions :)

Agreed, and don't forget the free sources. 
Do you realy need more?

--
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] ASyncReceive and wsoNoReceiveLoop

2007-11-29 Thread Arno Garrels
Jake Traynham wrote:

>So, it seems that for every time ASyncReceive looped, there would
> still be a message (FD_Read??) being put in the queue to call it
> again, which would call my DataAvailable event again, but there
> wouldn't be any data to read because ASyncReceive had already looped
> to get all the data. 

That's correct, it's the call to WSocket_Synchronized_ioctlsocket() 
with option FIONREAD that causes winsock to send the extra FD_READ
message.
So nothing is corrupted, simply add wsoNoReceiveLoop to the options
to get rid of that behaviour.
Winsock will always send subsequent FD_Read messages after any call
to one of the receive functions if there is still data available. 


> Should
> there have only been one FD_Read in the queue initially which would
> start the ASyncReceive loop but some how the queue is getting
> corrupted (by some call to ProcessMessages maybe) causing it to
> respond to the FD_Read more than once.  

See above.

> Or should there be an FD_Read
> for every block of data coming from the server, and if that's the
> case, why does ASyncReceive loop?  Because if there is an FD_Read for
> every block of data, then ASyncReceive and any DataAvailable events
> would be called multiple times. 

There is no relationship to the amount of data, there should be one
FD_Read message as long as data is available in winsock's receive buffer.
Looping in ASyncReceive is required before closing the socket in order
to not miss any pending data. 

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html






-- 
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] TWSocketServer and backlog

2007-11-29 Thread Arno Garrels
DZ-Jay wrote:
> On Nov 29, 2007, at 06:10, Wilfried Mestdagh wrote:
> 
>> Hello DZ-Jay,
>> 
>> So conclusion is that increasing the backlog does:
>>- decrease the performance for accepting connections
>>- decrease the overall performance of the application
> 
> This seems to be the conclusion of mine and Huby's tests.

Strange, I never noticed something like that.

> 
>> You can exchange data between threads the most easy is by posting a
>> message where a pointer to the data is in WParam argument. The
>> pointer can be freed in the custom message handler.

That's indeed the fastest way since the thread must not wait. 

> Perhaps I should run the TWSocketServer on its own thread, and post
> messages from the clients to the queue manager thread to do the work?
> Although this seems too complex and expensive.  It almost looks like
> each client should run on its own thread... :(

I'm that sure: 

1 - Stressing a server with 100 connection attempts per second is most
likely not a real world scenario, except upon DoS attacks.
2 - Run your stress tester against IIS or other servers, I found that
they were not able to accept more clients per second than my server.  
3 - I played with different designs. 
a) Listening sockets in one thread, client sockets in another thread(s).
   This introduces a new problem, clients are accepted very fast,
   however the listening thread must synchronize with the client
   thread(s) which may take longer than with current TWSocketServer,
   I worked around by posting just the socket handle to the thread
   which was fast, however also rather complicated to handle all
   the client stuff/pool in the threads.
b) Listening sockets in one thread, one thread per client.
   AFAIR without a thread pool accepting clients was slower than
   with TWSocketServer.
c) I even hacked together a server that used M$ overlapped sockets,
   this was a rather disapointing discourse since performance was
   the same as with (a). 

The goal is to accept clients as fast as possible, once they are 
connected it won't hurt to let them wait some milliseconds.

Before you rewrite your application I suggest you code some test
apps. with different designs and compare their performance.

--
Arno Garrels

> 
> dZ.
> 
> --
> DZ-Jay [TeamICS]
> http://www.overbyte.be/eng/overbyte/teamics.html
-- 
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] TWSocketServer and backlog

2007-11-29 Thread Arno Garrels
[EMAIL PROTECTED] wrote:
>> --- Original Message ---
>>> From    : Arno Garrels[mailto:[EMAIL PROTECTED]
>> 
>>> You can exchange data between threads the most
> easy is by posting a
>>> message where a pointer to the data is in WParam
> argument. The
>>> pointer can be freed in the custom message handler.
> 
>> That's indeed the fastest way since the thread must
> not wait.
> 
> However, if the main thread notified the slave
> threads to quit, the last thread that quits may post
> messages (before receiving the WM_QUIT message) to
> the first one and fail, which will cause the memory
> in the message to not be freed (until the application
> finally quits).  I don't know if this is a real
> concern, though.

When the process died the memory is given back to the 
OS anyway, so no problem. PostMessage() will return 
False on failure, in this case the memory can be
released by the calling thread.

> 
>> 1 - Stressing a server with 100 connection attempts per second is
>> most likely not a real world scenario, except upon DoS
> attacks.
> 
> I agree.  However, 
> 

It's easy to "DoS" any server ;-) 

>> 2 - Run your stress tester against IIS or other servers, I found that
>> they were not able to accept more clients per
> second than my server.
> 
> I'm sure this is true.

>> 3 - I played with different designs.
> 
> Which would you consider to work best?

Hard to tell, a good compromise is using TWSocketServer given
any lengthy task is run in worker threads. I think separating
socket IO work from other tasks by using worker threads for those
tasks considered "lengthy" is the way to go. The definition of 
"lengthy" however is another story then.  

--
Arno Garrels 


>-dZ.
> 
>> Sent: 11/29/2007 1:52:38 PM
>> To  : twsocket@elists.org
>> Cc  :
>> Subject : RE: Re: [twsocket] TWSocketServer and backlog
>> 
>  >DZ-Jay wrote:
>> On Nov 29, 2007, at 06:10, Wilfried Mestdagh wrote:
>> 
>>> Hello DZ-Jay,
>>> 
>>> So conclusion is that increasing the backlog does:
>>>- decrease the performance for accepting
> connections
>>>- decrease the overall performance of the
> application
>> 
>> This seems to be the conclusion of mine and Huby's
> tests.
> 
> Strange, I never noticed something like that.
>> Perhaps I should run the TWSocketServer on its own
> thread, and post
>> messages from the clients to the queue manager thread to do the work?
>> Although this seems too complex and expensive.  It
> almost looks like
>> each client should run on its own thread... :(
> 
> I'm that sure:
> 
> 1 - Stressing a server with 100 connection attempts
> per second is most
> likely not a real world scenario, except upon DoS
> attacks.
> 2 - Run your stress tester against IIS or other
> servers, I found that
> they were not able to accept more clients per second
> than my server.
> 3 - I played with different designs.
> a) Listening sockets in one thread, client
> sockets in another thread(s).
>This introduces a new problem, clients are
> accepted very fast,
>however the listening thread must synchronize
> with the client
>thread(s) which may take longer than with
> current TWSocketServer,
>I worked around by posting just the socket
> handle to the thread
>which was fast, however also rather
> complicated to handle all
>the client stuff/pool in the threads.
> b) Listening sockets in one thread, one thread
> per client.
>AFAIR without a thread pool accepting clients
> was slower than
>with TWSocketServer.
>     c) I even hacked together a server that used M$
> overlapped sockets,
>this was a rather disapointing discourse since
> performance was
>the same as with (a).
> 
> The goal is to accept clients as fast as possible,
> once they are
> connected it won't hurt to let them wait some
> milliseconds.
> 
> Before you rewrite your application I suggest you
> code some test
> apps. with different designs and compare their
> performance.
> 
> --
> Arno Garrels
> 
>> 
>> dZ.
>> 
>> --
>> DZ-Jay [TeamICS]
>>  http://www.overbyte.be/eng/overbyte/teamics.html
> --
> 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
-- 
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] Help with SmtpClient

2007-11-30 Thread Arno Garrels
Victor Gooch wrote:
> I am using BCB6 with SmtpClient. My program executes Open() then
> Helo() with no errors but when I try to execute Mail() I get an error
> message that the "Component is not Ready".  I have examined the
> property settings several times but do not see why Mail() does not
> work.  
> 
> is this a FAQ ?  

Looks like that ;-) You get this error when you do not code event-driven.
Check this link: http://wiki.overbyte.be/wiki/index.php/Asynchronous_Paradigm
to get started.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html





-- 
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] Exceptions ignored in OnDataAvailable method

2007-12-01 Thread Arno Garrels
DZ-Jay wrote:
> Hello:
> 
> In the TWSocket component, I've noticed that if an exception is thrown
> within an OnDataAvailable handler
> (which is triggered from TCustomWSocket.ASyncReceive() method) they
> will be ignored, and only the bMore flag is set to false which will
> stop the receive loop.

Have you got any exception that was raised from TWSocket internaly?
I mean outside of your handler?

--

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


<    1   2   3   4   5   6   7   8   9   10   >