Reputation: 128
I need to help with my ftp client application. I successfuly connect to server with usename and password and send PASV message. I recived IP and port, but i do not know what to do next. I know that I must connect to IP and port, but I do not know how.
Can somebody give me example of code how to connect and recive message from server?
Upvotes: 0
Views: 2187
Reputation: 5857
You already have the code which successfully connected to port 21 on the server, the same code will also work to connect to the IP address and port number that was returned in the PASV response.
BUT
You do not want to make this second connection until it is time to transfer some data. The first connection you established is for commands and responses to commands. The connection you make to the port returned by PASV is for the transfer of data following a command that actually transfers a file, for example RETR or LIST.
Upvotes: 0