1111111111
来源:互联网 发布:程序员java干什么的 编辑:程序博客网 时间:2024/05/16 07:31
#include <stdio.h> #include <stdlib.h> #include <time.h> #include "curl.h" #include <string.h> #include <pthread.h> #include <windows.h> #include <algorithm> #include <numeric> #include <vector> #include "Initialize.h"#include <iostream> //#define MAX_THREAD 30//总发送次数 static long int SucceNum = 0;//成功接收到得次数 static long int ErrorNum = 0;//失败次数static int StatCount = 0;LARGE_INTEGER m_nFreq;LARGE_INTEGER m_nCurrentUsTime; pthread_mutex_t mutex;//定义线程锁 std::vector<double> m_PacketUseTime;//收到包消耗的时间 //配置文件参数结构体 extern struct ConfigValue configvalues; char Putkey[1024]={0};struct HttpStatistics //计时 { double requestTime; double responseTime; }; char *GetLocaTime(int display){ time_t the_time; time(&the_time); if(1 == display){printf("The date is : %s" , ctime(&the_time)); }return ctime(&the_time);}int OutPutLog(int infotype, int count, char *localtime, char *infotext){FILE *out;if(infotype == 0){out = fopen( "Succeed.txt", "ab" );if(NULL == out){printf("have not Text , create Now \r\n");out = fopen( "Succeed.txt", "wb+" );}}else{out = fopen( "Error.txt", "ab" );if(NULL == out){printf("have not Text , create Now \r\n");out = fopen( "Error.txt", "wb+" );}}if( out != NULL ){fprintf( out, "%d ---- %s ---- %s\r\n",count, localtime, infotext);}else{printf("create text fail !!\r\n");return 1;}fclose(out);return 0;}struct HttpGetParam //参数 { char *url; struct HttpStatistics httpStatistics; }; static size_t write_data(void *ptr, size_t size, size_t nmemb, void *param) { return size * nmemb; }