472,978 Members | 1,959 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,978 software developers and data experts.

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 9068
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: מורדי | last post by:
Hi, I'm writing a client/server application in which the client send a series of screenshots to the server to be saved using the tcpclient. in most cases the first screenshot is transmitted ok...
10
by: Abubakar | last post by:
hi, I work on a computer that is part of a network and uses proxy to connect to net. I cant connect to servers outside my proxy with simple ConnectTo code. I need to know how to make my requests go...
5
by: Wal Turner | last post by:
This has been discussed in a prior thread but there was no solution proposed. Also, using WebRequest is not viable since we need a keep-alive connection. Can anyone provide any information on using...
0
by: Evan Freeman[C++ Samuri] | last post by:
Recently I found a question online that originated from this group, and those who responded to it were of no help to the poster. So I am sorry that I was not watching this group before, but will...
4
by: WATYF1 | last post by:
Hello. I'm writing a VB.NET app to check email message counts for both POP3 and IMAP4. I'm using TCPClient to connect, and a NetworkStream to send simple commands. It's a very simple bit of code,...
5
by: Jim W | last post by:
I have an ASP.NET app that has very slow connect times using TCPClient, or the Socket class, or even calling a COM object that uses C socket calls on certain similar XP SP2 boxes. On those...
0
by: Tamas Bojcan | last post by:
Hi, I use TcpClient class to obtain a NetworkStream object (via TcpClient's GetStream() method) in an ASP.Net webapp. This works well if I'm not behind proxy server but if I'm connected to the...
6
by: Julien | last post by:
Hi, I am developing a C# application to send requests to mail server to check email addresses validity. I use a TcpClient object to connect to it with the Connect(String hostname, Int32 port)...
0
by: aladdinm1 | last post by:
Dear all, I have a client application which working just fine except in one case: when it's behind a proxy. I tested it behind MS ISA with enabled Socks service. I tried everything to make it...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.