Home > Software engineering >  Consult a question about VB WINSOCK remote access to FTP remote directory list
Consult a question about VB WINSOCK remote access to FTP remote directory list

Time:11-03

I want to use the WINDSOCK access remote files in the directory, file content including unknown level subdirectories, access to files for batch download, equivalent to an FTP,
Current situation is can get a file's contents, but the recursive WINSOCK cannot return to the secondary directory access, basic process is as follows:
Private Sub Command1_Click ()
FF (Folder) '(through the access for the first time everything is normal, can get, but recursion is stuck in the "wscControl. SendData publishes the event" it "& amp; VbCrLf "return" 200 it command successful. "this step not to walk)
End Sub

The Public Function FolderFile (Folder As String)
If wscControl. State & lt;> 7 Then
MsgBox "please confirm that the current connection state!"
The Exit Function
End the If
WscControl. SendData publishes the event "it" & amp; VbCrLf
.
WscControl. SendData publishes the event "TYPE I" vbCrLf
.
WscControl. SendData publishes the event "PASV" & amp; VbCrLf

TmpIp=PassiveInfo (TMP, 1)
TmpPort=PassiveInfo (TMP, 2)
WscControl. SendData publishes the event "NLST" & amp; Folder & amp; VbCrLf
'data download
If wscList Is Nothing Then
Set wscList=Controls. The Add (" MSWinsock Winsock ", "wscList Me)
TimerData. Interval=100
TimerData. Enabled=True
End the If
With wscList
The RemoteHost=TmpIp
The RemotePort=TmpPort
. Connect
End With

Allfiles=tmpL

Dim f As an Integer, FL () As String
FL=Split (tmpL, vbCrLf)
For f=0 To UBound (FL)
If InStr (Right (FL (f), 5), ". ") & gt; 0 Then
Allfiles=Allfiles & amp; FL (f)
End the If
Next
For f=0 To UBound (FL)
If InStr (Right (FL (f), 5), ". ")=0 Then
If FL (f) & lt;> "" Then
Allfiles=Allfiles & amp; FF (FL (f)
End the If
End the If
Next
End the Function

Basic wscControl is Set wscControl=Controls. The Add (" MSWinsock. Winsock ", "wscControl", Me) generated by the
Would like to ask the master whether each loop need to be closed to reconnect again?
Or visit every time need to generate a WINSOCK?

The hope can give a better way than me, because halfway decent, VB are not ripe, it's best to source
My goal is to do an automatic FTP
First thanks

CodePudding user response:

Score is not enough, only very, hope the moderators can mobile version is not for me?" Programming... "

CodePudding user response:

Jacking jacking jacking
  • Related