|
-
Jun 27th, 2000, 09:47 AM
#1
Thread Starter
Lively Member
I am trying to use the inet control.
It doesn't seem to be able to connect with the server.
I connect to the server frequently using telnet so I am sure its not a server problem.
The code I am trying to use is:
Inet1.Protocol = icFTP
Inet1.UserName = MyUserNmae
Inet1.Password = MyPassWord
Inet1.Execute "chal.mta.ac.il","Dir *.*"
chal.mta.ac.il is what I type in the telnet hostname text box,I hope its the right parameter to give to the execute method.
Although msdn clame that I have to put in a protocol type in the url name.
How do I do that for ftp?
How can I display all directories of my account on the remote ,server in a listbox in my app?
(the remote system is unix)
Thanks.
Dan.
-
Jun 27th, 2000, 04:04 PM
#2
Try:
Inet1.Execute "ftp://chal.mta.ac.il","Dir *.*"
or
Inet1.Execute "ftp://" & MyUserName & ":" & MyPassword & "@chal.mta.ac.il","Dir *.*"
-
Jun 27th, 2000, 05:33 PM
#3
Thread Starter
Lively Member
Azzmodan
Thanks!
The second option Worked like a charm!!!
How would one display all files on the server computer in a list box ?
Thanks.
Dan.
-
Jun 27th, 2000, 07:02 PM
#4
Here is a simple example.
inetFTP: Internet Transfer Control
cmdDir: Commandbutton
lstDir: Listbox
Code:
Private Sub cmdDir_Click()
Dim sServer As String
Dim sUsername As String
Dim sPassword As String
'Initialize FPT settings
sServer = "127.0.0.1"
sUsername = "ftp"
sPassword = "ftp"
'Request DIR
inetFTP.Execute "ftp://" & sUsername & ":" & sPassword & "@" & sServer, "DIR"
End Sub
Private Sub inetFTP_StateChanged(ByVal State As Integer)
Dim sTemp As String 'Var for holding temp data
Dim sData As String 'Combined temp data
Dim saData() As String 'Splitted temp data
Dim iCounter As Integer 'Counter
'Check state
If State = icResponseCompleted Then 'The request has completed and all data has been received.
Do 'Make sure we have all data
sTemp = inetFTP.GetChunk(2048) 'Get first chunk
sData = sData & sTemp 'Append to data var
Loop Until Len(sTemp) = 0 'Check for more data
saData = Split(sData, vbCrLf) 'Split data into array
For iCounter = LBound(saData) To UBound(saData) - 2 'Dir data is delimited with 2 vbcrlf's
lstDir.AddItem saData(iCounter)
Next
End If
End Sub
Hope it helps,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|