本文整理汇总了C++中SSLSocket::Send方法的典型用法代码示例。如果您正苦于以下问题:C++ SSLSocket::Send方法的具体用法?C++ SSLSocket::Send怎么用?C++ SSLSocket::Send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SSLSocket
的用法示例。
在下文中一共展示了SSLSocket::Send方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
#if 1
//string ip = "service.evchong.com";
string ip = "123.59.53.85";
string buf;
string url;
string param;
HttpsPost httpspost;
do
{
//int ret = httpspost.Connect(ip, 443, HOSTNAME_TYPE);
int ret = httpspost.Connect(ip, 443, IP_TYPE);
if( HTTPS_CONNECTED == ret)
{
break;
}
else if( HTTPS_CONNECT_FALSE == ret)
{
break;
}
// 防止死循环,设置超时或者尝试次数,close break
}while(1);
#if 1
int ok_couter = 0;
int false_couter = 0;
int connectCouter = 1;
/*
while(1)
{
httpspost.State();
ok_couter++;
cout<< ok_couter<< endl;
sleep(1);
}
*/
while(1)
{
// heartbeat
url = "https://service.evchong.com:443/evchong_API/evchong/v1/heartbeat";
param = "{\"chargeBoxSerialNumber\":{\"chargeBoxSerialNumber\":\"1012090561\"},\"chargePointSerialNumber\":{\"chargePointSerialNumber\":\"CSN00001\"}}";
httpspost.State();
//if(httpspost.State() == HTTPS_FREE)
{
do
{
//int ret = httpspost.Connect(ip, 443, HOSTNAME_TYPE);
int ret = httpspost.Connect(ip, 443, IP_TYPE);
if( HTTPS_CONNECTED == ret)
{
connectCouter++;
break;
}
else if( HTTPS_CONNECT_FALSE == ret)
{
break;
}
// 防止死循环,设置超时或者尝试次数,close break
}while(1);
}
if( HTTPS_SENTED == httpspost.Send(url, param) )
{
cout<< ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> send heartbeat" << endl;
while(1)
{
int ret = httpspost.Recv(buf);
if(HTTPS_RECVED == ret)
{
ok_couter++;
//cout<< ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> revc heartbeat " << endl;
//cout<< "response: " << endl << buf << endl;
break;
}
else if(HTTPS_RECV_FALSE == ret)
{
false_couter++;
httpspost.Close();
//cout<< ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> recv heartbeat false and close" << endl;
break;
}
}
}
cout<<"connectCouter = "<< connectCouter << ", false_couter = " << false_couter << ", ok_couter = " << ok_couter << endl;
sleep(65);
}
#endif
//.........这里部分代码省略.........