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; OnValidxxxx 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: <twsocket@elists.org>
>>>>> 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
-- 
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

Reply via email to