473,566 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(co Channel.GetStre am());
coWriter = new StreamWriter(co Channel.GetStre am());

---

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(AddressF amily.InterNetw ork,
SocketType.Stre am,ProtocolType .Tcp);
socket.Connect( new IPEndPoint(IPAd dress.Parse(sIP Address),nPort) );

then sending data

Socket.Send(buf fer, 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 9162
On Thu, 08 Feb 2007 03:35:10 -0800, Peter <pR****@proco m-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...@nn owslpianmk.comw rote:
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
3034
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 and arrives at the server but from after that i only a couple of KB from the start of the file which cases the picture to display only the very top...
10
25096
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 through proxy. eg, _socket = new TcpClient("http://msdn.microsoft.com", port); does not work. Thanx. Ab.
5
6135
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 the TCPClient class (or other) via proxies and whether or not this is possible? Regards Wwal
0
1617
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 from now on and will offer my help as follows to anser the original question. ...
4
4458
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, actually... the problem is, if the user is behind a proxy, then the Connect method fails (times out). How do I get around this? I thought this...
5
2739
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 boxes, if another connection is made within a couple seconds, it is fast. Running the same C# code in a console app connects instantly. Unplugging the...
0
1354
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 network via proxy server I get "dead network..." error message during the creation of the TcpClient object. The most strange thing is that the same...
6
5710
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) method. When I use my application at home I don't have any problem to connect and get responses but when I try at work, I get the SocketException...
0
1552
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 connect from behind the proxy but, it failed. I'm using .Net Framework 2.0 and it looks like it does not support Socks proxies. Is there any solution...
0
7584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7644
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7951
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2083
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1201
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.