-
Hello,
I am trying to create an FTP Client using the Winsock Control. I don't want to use the INet Control.
My first question is how to send to log onto an FTP(send my username and password) and then how to list directories on my computer and the other persons computer. I would appreciate any code on this subject, please don't just give me a link to another site.
Thanks a bunch.
-
Winsock isn't the best for online communications due to it's complexity...it is more suitable for LAN situations and server/client applications. However, it is possible.
Code:
'Connect
Dim user As String
Dim pass As String
user = "username"
pass = "password"
Winsock1.Connect 123.123.123.123, 8989
Winsock1.SendData user
Winsock1.SendData pass
I know you requested not to be sent to other sites...but i think it would be worth your time to go toPlanetSourceCodep and have a look at these results for winsock ftp .
Gl,
D!m
[Edited by Dim on 11-16-2000 at 02:52 PM]
-
Well I've seen all the INet FTP Clients and it looks to me like they can only connect to an FTP URL and not an FTP server. What i mean is that you can't connect to an IPAddress using an INet Control, i dont know if this is true ? That's why i decided on Winsock. Is this true?
-
The second thing is the code you specified:
'Connect
user = '"username"
pass = '"password"
Winsock1.Connect 123.123.123.123, 8989
Winsock1.SendData user
Winsock1.SendData pass
Does not seem to work for me, it gives me an error saying wrong protocal for requested transaction and highlights,
Winsock1.senddata user
From one of the sites you linked me too it gave me code to send the username and password as follows:
Winsock1.SendData "USER " & strUserName & vbCrLf
Winsock1.SendData "PASS " & strPassWord & vbCrLf
I used that code and i didn't get an error but the server i'm using is Serv-U and for instance when you connect to Serv-U it says on it:
Connect to (then the IP)
IP Name (then the coputer you connected from)
and when i send the Username and Password there should also be something that says Logged in With (username)(password) or something to that affect.
Do you have any suggestions on why it's not saying that? anyother code for this i might be able to try? or am i wrong, am i logged on without it saying logged on? please reply again, thanks a bunch.
-
Inet CAN be used for ip's.
Code:
With Inet1
.Cancel
.Protocol = icFTP
.url = "123.123.123.123"
.UserName = "me"
.Password = "xxxx"
End With
'upload a file
Inet1.Execute , "PUT C:\test.txt test.txt"
'download file and download it to C:\test.txt
Inet1.Execute , "Get test.txt C:\test.txt"
you can also reffer to:
http://www.vbsquare.com/internet/inet1
http://www.vbsquare.com/internet/inet2
http://www.vbsquare.com/internet/inet3
for further help.
Gl,
D!m
-
Reffering to the winsock questions...i'm sorry but i wouldn't be able to explain it better than those examples on PSC.
Like i said earlier...winsock is confusing at times. I woudn't recomend usin inet because of it's unreliability. But if this will be an application mainly used by you then go ahead and use inet.
D!m
-
Well yes this program will only be used by myself and a friend whom i'm making with.
Typing an IP Address as the URL won't result in an error?
The point of this project is too make a Client that can cross download.(We want it too download multiple files at a time) i know i could just download one of these but we want to do it by ourselves and we want it to be customized for us. Now if you say Winsock is to complicated at times and INet is no good then is there some other control that you know of that's better?
Thanks for all your help so far.
-
Oh, can you use the remotehost property to connect to a server instead of the URL property? What i mean is can the URL property just be completely ignored?
-
Well there are other controls out there that are awesome at these kind of operations...but in most cases they are for sale. (http://www.mabry.com) in my opinion is one of the best.
Since it will only be used by two people...you should go along with inet and it will make life easier for you.
One problem you might have is the simultaneous downloading of several files. There are restrictions on that. I believe you can only download two files simultaneously using inet and anything more than that will produce errors.
And yes...you can use RemoteHost.
Gl,
D!m