当前位置: 首页>>代码示例>>C++>>正文


C++ MyServer::GetTid方法代码示例

本文整理汇总了C++中MyServer::GetTid方法的典型用法代码示例。如果您正苦于以下问题:C++ MyServer::GetTid方法的具体用法?C++ MyServer::GetTid怎么用?C++ MyServer::GetTid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MyServer的用法示例。


在下文中一共展示了MyServer::GetTid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(){
	srand((unsigned int)time(NULL));
	gettimeofday(&globalStartTime,NULL);

	MyServer *server;
//	MyClientManage *clientManage;

	std::map<std::string,std::string> keyMap;

	char *configFileName = "./config/simulator.cfg";
	ParseConfigFile(configFileName,keyMap);

	double serverBand,clientBand;
	int blockSize,perSendSize;
	bool isP2POpen;
	int fileNum;
	int maxLength,minLength;
	double minBitRate,maxBitRate;
	int serverFd;
	int blockNums,serverBlockNums;
	//add by sunpy 
	string bufferStrategy;
	int period;
	double lrfuLambda;
	//add end
	int thelta,lambda,zeta,sigma;
	int playToPlay,playToPause,playToForward,playToBackward,playToStop;
	int clientNums;
	int devNums;
	char *clusterAddress[MAX_DEV_NUM];
	int serverPort;
	int clientPort;
	int sampleFre;

	bool isUseRealDevice;

	serverBand = atof(keyMap["ServerBand"].c_str());
	clientBand = atof(keyMap["ClientBand"].c_str());
	blockSize = atoi(keyMap["BlockSize"].c_str());
	perSendSize = atoi(keyMap["PerSendSize"].c_str());
	isP2POpen = !strcmp(keyMap["isP2POpen"].c_str(),"true") ? true : false;
	fileNum = atoi(keyMap["SourceNums"].c_str());
	maxLength = atoi(keyMap["MaxLength"].c_str());
	minLength = atoi(keyMap["MinLength"].c_str());
	minBitRate = atof(keyMap["MinBitRate"].c_str());
	maxBitRate = atof(keyMap["MaxBitRate"].c_str());
	blockNums = atoi(keyMap["BlockNums"].c_str());
	//add by sunpy 
	serverBlockNums = atoi(keyMap["ServerBlockNums"].c_str());
	bufferStrategy = keyMap["BufferStrategy"];
	period = atoi(keyMap["Period"].c_str());
	lrfuLambda = atoi(keyMap["LrfuLambda"].c_str());
	//add end
	thelta = atoi(keyMap["Thelta"].c_str());
	lambda = atoi(keyMap["Lambda"].c_str());
	zeta = atoi(keyMap["Zeta"].c_str());
	sigma = atoi(keyMap["Sigma"].c_str());
	playToPlay = atoi(keyMap["PlayToPlay"].c_str());
	playToPause = atoi(keyMap["PlayToPause"].c_str());
	playToForward = atoi(keyMap["PlayToForward"].c_str());
	playToBackward = atoi(keyMap["PlayToBackward"].c_str());
	playToStop = atoi(keyMap["PlayToStop"].c_str());
	clientNums = atoi(keyMap["ClientNums"].c_str());
	devNums = atoi(keyMap["DevNums"].c_str());
	serverPort = atoi(keyMap["ServerPort"].c_str());
	clientPort = atoi(keyMap["ClientPort"].c_str());
	sampleFre = atoi(keyMap["SampleFrequency"].c_str());
	globalModify = atof(keyMap["Modify"].c_str());

	isUseRealDevice = !strcmp(keyMap["IsUseRealDevice"].c_str(),"true") ? true : false;

	int multiple = atoi(keyMap["Multiple"].c_str());
	globalTimer.setMultiple(multiple);

	stringstream sstring;
	for(int i = 0;i < devNums;i++){
		sstring.str("");
		sstring << "ClusterAddress" << (i + 1);
		string keyName = sstring.str();
		clusterAddress[i] = const_cast<char *>(keyMap[keyName.c_str()].c_str());
	}

	server = new MyServer(serverBand,blockSize,serverBlockNums,bufferStrategy,period,lrfuLambda,perSendSize,isP2POpen,fileNum,maxLength,minLength,
			minBitRate,maxBitRate,serverPort,clientPort,devNums,clientNums,clusterAddress,sampleFre,isUseRealDevice);

//	clientManage = new MyClientManage(serverFd,perSendSize,blockSize,blockNums,clientBand,fileNum,thelta,lambda,
//			zeta,sigma,playToPlay,playToPause,playToForward,playToBackward,playToStop,clientNums);
//
//	cout << "create clients" << endl;
//	clientManage->CreateClient();

//	sleep(10);

	pthread_join(server->GetTid(),NULL);

	keyMap.clear();
	delete server;
//	delete clientManage;

//	exit(0);
//.........这里部分代码省略.........
开发者ID:sunpy1106,项目名称:Simulator,代码行数:101,代码来源:servermain.cpp


注:本文中的MyServer::GetTid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。