[Very slightly OT] Verbing with FTP
[Very slightly OT] Verbing with FTP
- Subject: [Very slightly OT] Verbing with FTP
- From: Sam Goldman <email@hidden>
- Date: Wed, 14 Nov 2001 00:05:52 -0800
I am writing a cocoa app for connecting to FTP servers.
I can get to the point where I have just sent the USER, PASS, and PASV
verbs. I then get back a response from the server like this:
220 localhost FtP server (Verison 6.00LS) ready.
331 Password required for sgoldman
230 User sgoldman logged in.
227 Entering Passive Mode (127,0,0,1,193,175)
I know that I have to get this URL somehow 127.0.0.1:49583 where 49583 =
913*256+175.
Those of you that have done this know EXACTLY what the above means. What I
first need to figure out is how to parse out "127.0.0.1:49583" from "227
Entering Passive Mode (127,0,0,1,193,175)" without quotes of course.
Next I want to get a directory listing. What do I do with this IP? I would
be inclined to make another socket connection to the server and request LIST
with LIST\015\012, but I don't know if that right. If I do need to make
another connection, do I need to send my USER and PASS verbs again?
In short, what do I do after receiving the servers response to the PASV verb
to get a directory listing.
From what I can understand. I don't have to use passive, but when I try to
send the LIST verb right after logging in, the server refuses my connection!
Hell, if you can understand that (I only partially do myself) I'd really
appreciate some help. I read numerous FTP Protocol references and
descriptions, but still can't figure it out.
- Sam