Click here to Skip to main content
15,891,770 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ;

I just wanted to Make a FTP Connection using two TCP Connection In C# ,

And this is an Active FTP

I don't know how to Write this Program

And this Two TCP Connections Are from The Client !

The Client ( MY PC ) make 2 TCP Connections To Active FTP Server One connections For Download and One For Upload !
Posted
Updated 2-Feb-10 21:16pm
v2

If the two machines have a TCP/IP connection between them, they both have an IP address. That's what you attempt to connect to using FTP.
 
Share this answer
 
It sounds like what you are trying to do cannot be done.

A TCP connection has two ends, the one from which is starts and the one to which it connects. Once the connections established, then data can pass both ways along it.

In Active FTP, the client makes a connection to the server. Then the server makes any number of connections back to the client. This means that your model of 2 TCP connections from the client to the server, one for upload and one for download does not fit with the connections both coming from the client.

I suspect what you are trying to do is to make two FTP sessions to the server. One of these for upload and one for download?

There is an article here C# FTP Client Library[^] which shows how to make an FTP session. I don't know if it is what you want (it might not support active FTP even - but it is a start).

Once you have found a good way of making your ftp sessions then I would suggest that you simple create two of them. If you want them to work at the same time - then put them in different threads and use lock statements to create mutex code blocks for control between the two if required. Alternatively, use delegates to communicate between the threads.

Good luck :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900