Hello Sham,

The code say: "Should never comes here" so I'm wondering what is wrong
here. Did you test your application in a normal GUI and do you
experiance same error ?

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

Thursday, April 20, 2006, 15:52, Shamresh Khan wrote:

> Hi to all,

> I have an FTPServer running within a Service. I have found that sometimes my
> service is killed.

> Although I have not been able to reproduce why this has happening, I have
> found that in the IDE, if I set break points in the 
> FtpServerStorSessionConnecEvent and the
> FtpServerStorSessionClosedEvent, the 
> client timeouts (5 second read timeout on each client command) I get the
> access violation "Program error in ClientStorSessionClosed" being raised
> which kills my service. I also saw this problem if I pull out the network
> cable of the FTP server.

> The way my FTP client works is to try sending files and if there is an
> error, it will try at a later time (few seconds later).

> Would it be possible for me to replace the line raise 
> Exception.Create('Program error in ClientStorSessionClosed'); below for the
> command Exit. Would this cause any other problems? This way the service will
> not die.

> procedure TFtpServer.ClientStorSessionClosed(Sender : TObject; AError  :
> Word);
> var
>     Client      : TFtpCtrlSocket;
>     Data        : TWSocket;
> begin
>     Data                     := TWSocket(Sender);
>     Client                   := TFtpCtrlSocket(Data.Owner);
> { !!!!!!!! NGB: Free Up Current Port - next 2 lines added }
>     if Client.PassiveConnected and (FPasvPortRangeSize > 0) then
>         FreeCurrentPasvPort(Client);
> { !!!!!!!! NGB: previous 2 lines added }

>     Client.DataSessionActive := FALSE;
>     Client.PassiveStart      := FALSE;
>     Client.PassiveConnected  := FALSE;
>     Client.RestartPos        := 0;
>     { Reset data port to standard value }
>     Client.DataPort          := 'ftp-data';

>     { If we had opened a data stream ourself, then close it }
>     if Client.HasOpenedFile then begin
>         if Assigned(Client.DataStream) then
>             Client.DataStream.Destroy;
>         Client.DataStream    := nil;
>         Client.HasOpenedFile := FALSE;
>     end;

>     TriggerStorSessionClosed(Client, Data, AError);

>     case Client.CurCmdType of
>     ftpcSTOR :
>         begin
>             if Client.AbortingTransfer then
>                 SendAnswer(Client, Format(msgStorAborted, 
> [Client.TransferError]))
>             else if AError = 0 then
>                 SendAnswer(Client, msgStorOk)
>             else
>                 SendAnswer(Client, Format(msgStorError, [AError]));
>         end;
>     ftpcAPPE :
>         begin
>             if Client.AbortingTransfer then
>                 SendAnswer(Client, Format(msgAppeAborted, 
> [Client.TransferError]))
>             else if AError = 0 then
>                 SendAnswer(Client, msgAppeOk)
>             else
>                 SendAnswer(Client, Format(msgAppeError, [AError]));
>         end;
>     ftpcSTOU :
>         begin
>             if Client.AbortingTransfer then
>                 SendAnswer(Client, Format(msgStouAborted, 
> [Client.TransferError]))
>             else if AError = 0 then
>                 SendAnswer(Client, Format (msgStouOk, [Client.FileName]))
>             else
>                 SendAnswer(Client, Format(msgStouError, [AError]));
>         end;
>     else { Should never comes here }
>       raise Exception.Create('Program error in ClientStorSessionClosed');
>     end;
> end;

> Regards
> Sham.



-- 
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