Kevin
Tue May 16 09:31:43 CDT 2006
I also built a managed FTP client library using Sockets. I found the
FtpWebRequest to be problematic when used for anything but the simplest
commands. It hides too much information, making it difficult to debug. In
addition, I found the programming interface counter-intuitive, as it was
designed to behave in the same way as the HttpWebRequest, which encapsulates
an entirely different sort of protocol. HTTP is a protocol which is used for
atomic Request/Response operations, and uses a single port and TCP
connection, while FTP maintains an open connection for the Control, and
opens a separate connection to send and receive Data. I felt that the
decision to make the 2 programming interfaces similar was a mistake, and
violated good OOP principles, which dictate that the object model should
resemble the actual underlying technology. In this case, it resembles HTTP
rather than FTP, and is therefore counter-intuitive, as well as hiding
(without remedy) what is going on underneath, except for the Response codes
and status messages. That is not a problem when everything goes well, but
FTP is not nearly as reliable as HTTP, and when something goes wrong, you
need to look under the hood to find out why. Network tracing only provides a
modicum of information, which is helpful in some respects, but doesn't
provide any information about the actual data sent and received over the
Socket.
In my case, I was trying to diagnose an intermittent "Client Closed
Connection" error, which it turns out was caused by a clustered FTP server
requiring a specific client IP address to connect, and for which only one of
the machines was configured to accept our IP address. I only found this out
by some rather deep probing using a Socket-based class (with the help of
Ethereal).
--
HTH,
Kevin Spencer
Microsoft MVP
Professional Numbskull
Hard work is a medication for which
there is no placebo.
"Gaurav Vaish (EduJini.IN)" <gaurav.vaish.nospam@nospam.gmail.com> wrote in
message news:e20UPpIeGHA.4128@TK2MSFTNGP05.phx.gbl...
>> is throwing the 501 error since the parameters I am using for the RETR
>> command (using the WebRequestMethods.Ftp.DownloadFile) are the same
>> strings I
>> use for the VB6 wininet.dll stuff. Is there anyway to look inside the
>> request
>
> 1. Are you trying to create a FTP client library?
> 2. Do you need a managed FTP client library?
>
> In case of (1), don't use WebRequest. You Sockets directly. They will be
> better.
> In case of (2), you can drop me a mail at info[at]edujini[dot]in for the
> library and/or source code. We have a fully featured FTP library written
> in C#
>
> --
> Cheers,
> Gaurav
>
http://www.edujini.in
> -------------------
>
>