help with FTP clients.

G

Guoqi Zheng

Dear sir,

I am trying to write an FTP class using system.net sockets. I am using XP.
The class never works, it seems that the client always waiting for response
from server. So I try to connect to Remote FTP server using telnet, then I
always get an error of
"425 Can't open data connection

Below are a part of my code, does some one able to tell me what I did wrong/

qqTcpClient = New System.Net.Sockets.TcpClient
Console.WriteLine("I am testing")
Dim Reply As String
Console.WriteLine("connecting")
qqTcpClient.Connect("217.170.3.24", 21)
qqNetworkStream = qqTcpClient.GetStream()


Reply = GetResponse()
Console.WriteLine(Reply)
Console.WriteLine("loging")

SendText("HELP")

' it stops here.

Private Sub SendText(ByVal strMsg As String)
Dim strByte As [Byte]()
strByte = System.Text.Encoding.ASCII.GetBytes(strMsg.ToCharArray())
qqNetworkStream.Write(strByte, 0, strByte.Length)
End Sub


--
Kind regards

Guoqi Zheng
guoqi AT meetholland dot com
Http://www.meetholland.com
 
K

Ken Tucker [MVP]

Hi,

Here is an example that uses indy to do ftp. Indy is an open source
project.

www.onteorasoftware.com/downloads/indy.zip

http://www.indyproject.org/Indy.html

Ken
------------------
Dear sir,

I am trying to write an FTP class using system.net sockets. I am using XP.
The class never works, it seems that the client always waiting for response
from server. So I try to connect to Remote FTP server using telnet, then I
always get an error of
"425 Can't open data connection

Below are a part of my code, does some one able to tell me what I did wrong/

qqTcpClient = New System.Net.Sockets.TcpClient
Console.WriteLine("I am testing")
Dim Reply As String
Console.WriteLine("connecting")
qqTcpClient.Connect("217.170.3.24", 21)
qqNetworkStream = qqTcpClient.GetStream()


Reply = GetResponse()
Console.WriteLine(Reply)
Console.WriteLine("loging")

SendText("HELP")

' it stops here.

Private Sub SendText(ByVal strMsg As String)
Dim strByte As [Byte]()
strByte = System.Text.Encoding.ASCII.GetBytes(strMsg.ToCharArray())
qqNetworkStream.Write(strByte, 0, strByte.Length)
End Sub


--
Kind regards

Guoqi Zheng
guoqi AT meetholland dot com
Http://www.meetholland.com
 
Top