![]() } while (strncmp(sendBuff, quitBuff, 4) != 0) // Go until QUIT Command is entered Write(fileno(stdout), receiveBuff, sizeof(receiveBuff) - 1) Read(dataSock, receiveBuff, sizeof(receiveBuff) - 1) If (connect(dataSock, (struct sockaddr *)&servAdr, sizeof(servAdr)) < 0) If ((dataSock = socket(PF_INET, SOCK_STREAM, 0)) < 0) ServAdr.sin_port = htons(dataPort) // Use FTP port If ((origSock = socket(PF_INET, SOCK_STREAM, 0)) h_addr, host->h_length) Int origSock // Original socket in client * Create Socket to Connect to FTP Server */ ServAdr.sin_port = htons(FTP_PORT) // Use FTP port ![]() ![]() Int a1, a2, a3, a4, p1, p2, dataPort //PASV Information const int FTP_PORT = 21 // Server PortĬonst int SIZE = 1024 // Size of BuffersĬhar receiveBuff // Buffer to send to the serverĬhar sendBuff // Buffer to receive from serverĬhar pasvBuff = "pasv" // Buffer to see if PASV Command was enteredĬhar quitBuff = "QUIT" // Buffer to see if QUIT Command was enteredĬhar pasvMessage // String for PASV information I'm not getting a response back from the server (if I'm actually suppose to get one, I don't know) Please ask any questions or concerns, thanks. I don't know if I need to get the server address again the same way. Once I have the port, I try to create another socket and connecting to it the same way. 227 Entering Passive Mode (a1, a2, a3, a4, p1, p2) I get the message, parse it, then calculate the port from the replay message when PASV is entered. The trouble I'm having is connecting to the port that is specified when the command PASV is entered. I connect using sockets onto port 21, like any regular FTP client. What I have working so far is the connection and login. I'm attempting to create a simple FTP client in C/C++ that will do simple operations (connect, retrieve file).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |