Wininet , действия отличаются на двух компьютерах

  • Автор темы Owyn
  • Дата начала
O

Owyn

Гость
#1
C++:
		char file[120]="myfile.jpeg"
char fn[120]="myinfo.jpeg"

char *user="username";
char *pass="password";
char *ftpserver="ftp.myserver.com";
char *filetosend=file;
char *filetosend2=fn;

char filetosendtoC[255];
wsprintf(filetosendtoC,"ftproot\\screens\\%s",file);
char filetosendto2C[255];
wsprintf(filetosendto2C,"ftproot\\info\\%s",fn);

char *filetosendto=filetosendtoC;
char *filetosendto2=filetosendto2C;


HINTERNET hInternet;
HINTERNET hFtpSession;
hInternet = InternetOpen(NULL,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,0);
hFtpSession = InternetConnect(hInternet,ftpserver , INTERNET_DEFAULT_FTP_PORT, user, pass, INTERNET_SERVICE_FTP, 0, 0);
if(	FtpPutFile(hFtpSession, filetosend, filetosendto, FTP_TRANSFER_TYPE_BINARY, INTERNET_FLAG_PASSIVE) == TRUE){
//File Sent!
Sleep(1000);
if(	FtpPutFile(hFtpSession, filetosend2, filetosendto2, FTP_TRANSFER_TYPE_BINARY, INTERNET_FLAG_PASSIVE) == TRUE){
//File Sent!
Sleep(1000);
InternetCloseHandle(hFtpSession);
InternetCloseHandle(hInternet);
}
else{
//error
}
InternetCloseHandle(hFtpSession);
InternetCloseHandle(hInternet);
}
else{
//error
}
на моем компьютере этот код прекрасно работает, но у друга совсем по другому, вот лог фтп сервера:

я:

Jun 01 20:28:36 908 Incoming connection request on interface 93.81.248.130 //мой ип, я
Jun 01 20:28:36 908 Connection request accepted from 93.81.248.130
Jun 01 20:28:36 908 USER username
Jun 01 20:28:36 908 331 User username, password please
Jun 01 20:28:36 908 PASS ***********
Jun 01 20:28:36 908 230 Password Ok, User logged in
Jun 01 20:28:36 908 TYPE I
Jun 01 20:28:36 908 200 Type Binary
Jun 01 20:28:36 908 PORT 93,81,248,130,5,96
Jun 01 20:28:36 908 200 Port command received
Jun 01 20:28:36 908 STOR ftproot\screens\myfile.jpeg
Jun 01 20:28:36 908 150 Opening data connection
Jun 01 20:28:36 908 File transfer complete
Jun 01 20:28:36 908 226 Transfer complete
Jun 01 20:28:37 908 TYPE I
Jun 01 20:28:37 908 200 Type Binary
Jun 01 20:28:37 908 PORT 93,81,248,130,5,97
Jun 01 20:28:37 908 200 Port command received
Jun 01 20:28:37 908 STOR ftproot\info\myinfo.jpeg
Jun 01 20:28:37 908 150 Opening data connection
Jun 01 20:28:37 908 File transfer complete
Jun 01 20:28:37 908 226 Transfer complete
Jun 01 20:28:38 908 The connection was closed by the remote socket
Jun 01 20:28:38 908 Connection terminated.
друг:

Jun 01 20:31:42 915 Incoming connection request on interface 93.81.248.130 //его ип, он
Jun 01 20:31:42 915 Connection request accepted from 77.243.100.173
Jun 01 20:31:42 915 USER username
Jun 01 20:31:42 915 331 User username, password please
Jun 01 20:31:42 915 PASS ***********
Jun 01 20:31:42 915 230 Password Ok, User logged in
Jun 01 20:31:42 915 CWD ftproot
Jun 01 20:31:42 915 250 Change directory ok
Jun 01 20:31:43 915 CWD screens
Jun 01 20:31:43 915 250 Change directory ok
Jun 01 20:31:43 915 PORT 10,233,15,11,19,139
Jun 01 20:31:43 915 200 Port command received
Jun 01 20:31:43 915 STOR myfile.jpeg
Jun 01 20:32:04 915 Unable to connect : Попытка установить соединение была безуспешной, т.к. от другого компьютера за требуемое время не получен нужный отклик, или было разорвано уже установленное соединение из-за неверного отклика уже подключенного компьютера.
Jun 01 20:32:04 915 425 Unable to open the data connection
Jun 01 20:32:36 912 Connection timed out. Shutting down connection...
Jun 01 20:32:36 912 Connection terminated.