469,269 Members | 1,006 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,269 developers. It's quick & easy.

FTP via TcpClient and Proxy

Hi

I rewrite an old C Programm to C# (Framework 1.1) - it is an easy FTP-
Client.
I create a "Command-Channel" using TcpClient, a "Command-Reader" and a
"Command-Writer"
to speak with the FTP Server

coChannel = new TcpClient(this.HostName, this.Port);
coReader = new StreamReader(coChannel.GetStream());
coWriter = new StreamWriter(coChannel.GetStream());

---

To send data I use a Socket. First I send the "PASV" Command to the
server
using the response (IP-adress, Port) to create a socket.

socket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream,ProtocolType.Tcp);
socket.Connect(new IPEndPoint(IPAddress.Parse(sIPAddress),nPort));

then sending data

Socket.Send(buffer, read, 0);

--

Everything works fine the last 10 years with the C Pgm. And the C# Pgm
works also fine.

Now we have a problem to connect one special FTP Server.
The Operator of this Server use a Proxy "before" his FTP-Server and
believe that my program is not "proxy-able".
But I dont know what he mean.

How can I use the TcpClient() "with a Proxy" to connect to a Server.

Thanks
Peter

Feb 8 '07 #1
4 8729
On Thu, 08 Feb 2007 03:35:10 -0800, Peter <pR****@procom-gmbh.comwrote:
[...]
Now we have a problem to connect one special FTP Server.
The Operator of this Server use a Proxy "before" his FTP-Server and
believe that my program is not "proxy-able".
But I dont know what he mean.

How can I use the TcpClient() "with a Proxy" to connect to a Server.
If he's the one with the proxy and the FTP server, he's the one that needs
to fix the issue.

The main thing is that the proxy server will need to be configured to
forward connection requests to the FTP server. It has nothing (well, very
little) to do with your FTP client.

He may be getting confused by the use of passive mode, since this requires
an additional inbound connection to his server from your client. This
means it's not sufficient for the proxy to just forward traffic on a
single port. But any decent proxy should be able to be configured to
forward traffic based on existing connections (ie the initial connection
made to the FTP server from the client).

FTP clients not using passive mode probably work fine with his FTP server,
since the clients host the secondary connection and all his server has to
do is connect to the clients. But non-passive mode doesn't work very well
for most clients that are behind proxies or NAT routers themselves, and
the server should be able to handle all clients, whether they use passive
mode or not.

Pete
Feb 8 '07 #2
How can I use the TcpClient() "with a Proxy" to connect to a Server.

Checkout the following topics:

1. SOCKS server
2. HTTP Tunneling (HTTP Proxy Command: CONNECT)
3. HTTP Proxy - commands: OPEN, SITE and USER

Ask the operator to provide you the information about the details of the
proxy server -- what does it support?

--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
Feb 9 '07 #3
If he's the one with the proxy and the FTP server, he's the one that needs
to fix the issue.

The main thing is that the proxy server will need to be configured to
forward connection requests to the FTP server. It has nothing (well, very
little) to do with your FTP client.

I'm not quite sure... but if I understood the original problem correctly,
the server is outside the firewall/proxy. The connection has to be made from
within.

If I got it wrong... ie, if an inbound connection is required, ask your
operator to look into the topics of NAT.

--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
Feb 9 '07 #4
On 8 Feb., 18:39, "Peter Duniho" <NpOeStPe...@nnowslpianmk.comwrote:
On Thu, 08 Feb 2007 03:35:10 -0800,Peter<pRu...@procom-gmbh.comwrote:
[...]
Now we have a problem to connect one special FTP Server.
The Operator of this Server use a Proxy "before" his FTP-Server and
believe that my program is not "proxy-able".
But I dont know what he mean.
How can I use theTcpClient() "with a Proxy" to connect to a Server.

If he's the one with the proxy and the FTP server, he's the one that needs
to fix the issue.

The main thing is that the proxy server will need to be configured to
forward connection requests to the FTP server. It has nothing (well, very
little) to do with your FTP client.

He may be getting confused by the use of passive mode, since this requires
an additional inbound connection to his server from your client. This
means it's not sufficient for the proxy to just forward traffic on a
single port. But any decent proxy should be able to be configured to
forward traffic based on existing connections (ie the initial connection
made to the FTP server from the client).

FTP clients not using passive mode probably work fine with his FTP server,
since the clients host the secondary connection and all his server has to
do is connect to the clients. But non-passive mode doesn't work very well
for most clients that are behind proxies or NAT routers themselves, and
the server should be able to handle all clients, whether they use passive
mode or not.

Pete
Thank you for the Information

my client works fine after making some settings on the proxy!
With "proxy-able" he means that the Ftp-Logon is username@ftp-server
-- oh well!

Peter


Feb 13 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by מורדי | last post: by
10 posts views Thread by Abubakar | last post: by
5 posts views Thread by Wal Turner | last post: by
reply views Thread by Evan Freeman[C++ Samuri] | last post: by
reply views Thread by Tamas Bojcan | last post: by
6 posts views Thread by Julien | last post: by
reply views Thread by aladdinm1 | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.