马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 BaiBai2011 于 2014-12-4 20:50 编辑
增加计算下载文件MD5
*详细代码下载工程*//http://dlsw.baidu.com/sw-search-sp/soft/d6/14991/setup_4.7.0.4087.3217271759.exe
//http://down.360safe.com/360/inst.exe
#include <stdio.h>
#include <windows.h>
#include <winsock.h>
#pragma comment(lib,"ws2_32.lib")
#include "./md5/md5.h"
#define FILE_SRV "dlsw.baidu.com"
#define FILE_DIR "sw-search-sp/soft/d6/14991/setup_4.7.0.4087.3217271759.exe"
#define USER_AGE "RookIE/1.0"
#define SAVE_FILE_DIR "DownLoad001.exe"
#define MAXLEN 1024
char strA[1024]={0};
int main(int argc, char* argv[])
{
MD5_CTX md5;
MD5Init(&md5); //初始化MD5算法
unsigned char MD5_SS[16]={0};
WORD wVersionRequested;
WSADATA wsaData;
wVersionRequested = MAKEWORD( 1, 1 );
WSAStartup( wVersionRequested, &wsaData );
SOCKET sck = socket(AF_INET,SOCK_STREAM,NULL);
SOCKADDR_IN adr;
hostent *mhst = gethostbyname(FILE_SRV);
adr.sin_addr.S_un = ((in_addr*)mhst->h_addr_list[0])->S_un;
adr.sin_family = AF_INET;
adr.sin_port = htons(80);
.......
|