Bonsoir tout le monde!
j'ai un problème, j'essai de télécharger un fichier .rar avec GET
et quand je veux extraire le rar il m'indique que le fichier est conromput
rRecv=1;
WSAStartup(MAKEWORD(2,0), &wsa);
Sock = socket(AF_INET, SOCK_STREAM, 0);
Sin.sin_addr.s_addr = inet_addr(InternetProtocol);
Sin.sin_family = AF_INET;
Sin.sin_port = htons(80);
error = connect(Sock, (SOCKADDR*)&Sin, sizeof(Sin));
if(error != SOCKET_ERROR)
{
printf("Connected !\n");
File = fopen(FileName, "w+");
sprintf(str, "GET %s HTTP/1.1\r\nhost: %s\r\n\r\n", FileNameTarget, host_name);
send(Sock, str, strlen(str), 0);
while(rRecv>0)
{rRecv=recv(Sock, &c, sizeof(char), 0); fputc(c, File);}
}
else
{
printf("NOT Connected !\n");
}
closesocket(Sock);
WSACleanup();
je ne trouve pas le problème...
Pouvez vous m'aider ? sa serait sympa ^^