Exemplo n.º 1
0
string Client::getBinaryData(int len, bool isLengthIncluded)
{
	//logger << len;
	string alldat;
	char *buf1 = new char[len];
	memset(buf1, 0, len);
	recv(sockfd, buf1, len, 0);
	for (int var = 0; var < len; ++var) {
		alldat.push_back(buf1[var]);
	}
	memset(buf1, 0, len);

	int leng = getLengthCl(alldat, len);
	if(isLengthIncluded)
	{
		leng -= len;
	}
	//logger << "done reading header length " << leng;
	char *buf = new char[leng];
	memset(buf, 0, sizeof(buf));
	recv(sockfd, buf, leng, 0);
	for (int var = 0; var < leng; ++var) {
		alldat.push_back(buf[var]);
	}
	memset(buf, 0, sizeof(buf));
	//logger << alldat.length();
	return alldat;
}
Exemplo n.º 2
0
string Client::getBinaryData(int len, bool isLengthIncluded)
{
	//logger << len;
	string alldat;
	char *buf1 = new char[len];
	memset(buf1, 0, len);
	recv(sockfd, buf1, len, 0);
	for (int var = 0; var < len; ++var) {
		alldat.push_back(buf1[var]);
	}
	delete[] buf1;

	int leng = getLengthCl(alldat, len);
	if(isLengthIncluded)
	{
		leng -= len;
	}
	char *buf = new char[leng];
	memset(buf, 0, leng);
	recv(sockfd, buf, leng, 0);
	for (int var = 0; var < leng; ++var) {
		alldat.push_back(buf[var]);
	}
	delete[] buf;
	return alldat;
}
Exemplo n.º 3
0
string SSLClient::getBinaryData(const int& len, const bool& isLengthIncluded)
{
	//logger << len;
	string alldat = getData(len);

	int leng = getLengthCl(alldat, len);
	if(isLengthIncluded)
	{
		leng -= len;
	}
	//logger << "done reading header length " << leng;
	alldat = getData(leng);
	logger << alldat.length();
	return alldat;
}