再问:FTP连接问题
连接一个FTP服务器TSERVER,使用Active模式
在使用PORT指令后,系统提示"PORT command successful".
然后我建立socket,并连接FTP服务器,但此时显示错误提示:
"由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。"
下面是我的代码
====================================
Dim strT As String
strT = "192,168,42,27,19,70"
'192.168.42.27:是本地IP地址
'19,70:是自己随意设定的
sendCommand("PORT " & strT)
Dim ipAddress As String = Me.strServer
Dim port As Int32 = 19 * 256 + 70
Dim socket As Socket = Nothing
Dim ep As IPEndPoint = Nothing
socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
ep = New IPEndPoint(Dns.Resolve(ipAddress).AddressList(0), port)
socket.Connect(ep)
====================================
大家帮忙看看有什么问题?或有什么建议?
PS.使用PASV可以连接某些服务器,但连接TSERVER不行。