Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.4k views
in .NET FTP by
An unhandled exception of type 'System.IO.IOException' occurred in system.dll

Additional information: Unable to read data from the transport connection.


The exception was raised after I leave the session purposely inactive.
I'm trying to learn a simple way to know the session status.
So, my test app have a button to send a NOOP command ( the most simple I can guess ).
I left the session idle more time than the server allows, and after that
tried the NoOperation( ) method.
The exception is raised in ftpcontrolsocket.cs, at ReadReply

internal virtual FTPReply ReadReply()
{            
   string line = reader.ReadLine(); // here is where the exception is raised
   while (line != null && line.Length == 0)
          line = reader.ReadLine();
            
   Log(line, false);

   .... more code follows 


Could I patch the code with a try/catch block ?

But what is intriguing to me, is that this server surely sends a 421 reply before shutting down the connection.
So, it migth be in the input buffer of the socket, it seems.
Or when the other party closes the connection, Windows flushes al buffers ?

I'm using version 1.1.8

2 Answers

0 votes
by (51.6k points)
But what is intriguing to me, is that this server surely sends a 421 reply before shutting down the connection.


I think it's unlikely that the server would send anything before closing the connection. I'm not aware of any cases in the FTP protocol where the server will initiate a control channel communication. The client sends a command and the server replies to that - not vice-versa. In the case you mention, the server would be sending a 421 reply which is not a response to any command.

I think that the server will simply close the connection when it times out.

- Hans (EDT)
0 votes
by (162k points)
Some servers may indeed return 421 from your NOOP as they probably should, however long experience with FTP has taught us not to expect FTP servers to implement the standard exactly.

Categories

...