System.Net.Socket question

  • Thread starter Thread starter Steven Van Eyck
  • Start date Start date
S

Steven Van Eyck

Hi there

I've been trying to implement an ACTIVE FTP mode in my class.

Read tons of great articles about the difference of Active and Passive
modes, in particular this one, which I find very good
http://slacksite.com/other/ftp.html, but it seems that many have tried to
actually implement Active FTP, but failed or have given up.

So far, I've managed to build the arguments needed for the FTP PORT command,
issued it to the FTP server and received the response, which was 200 (all
good).

I configured a socket on a port of the client, the same port I instructed
the server to connect to, in order to receive data from the FTP server.

But it would seems that the FTP server doesn't make a connection on the port
I sent it, using the PORT command.

I've tried listening for incoming connection requests and accepting them,
but nothing seems to be coming in. In spite of the fact the PORT command was
accepted by the server.

I'm going to try to trace the network packages, hopefully that will give me
something new to go on.

Should there be anyone out there that has encountered a similar thing, I beg
you to shed some light on this subject ;-)

Thanks in advance.

Best regards
 
Hi

A small update on this question.

I managed to find out the problem by analysing the network packets and it
appears that the remote server does not yet establish a connection on the
local port after the POST command.

It appears to wait for a real command that would actually return data, like
fe NLST, so the solution was to start listening on the socket after this
command was issued.

Unfortunately while receiving the data, the server closed the connection on
the command port. Maybe because I tried to download too much data ??
The error message was: "550 An established connection was aborted by the
software in your host machine."

Anybody knows the reason for this behaviour ?

Many thanks
 
Back
Top