本文整理汇总了C++中TCPSocket::GetSocketFD方法的典型用法代码示例。如果您正苦于以下问题:C++ TCPSocket::GetSocketFD方法的具体用法?C++ TCPSocket::GetSocketFD怎么用?C++ TCPSocket::GetSocketFD使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPSocket
的用法示例。
在下文中一共展示了TCPSocket::GetSocketFD方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
void LRTGroupSession::Init()
{
TCPSocket* socket = this->GetSocket();
socket->Open();
socket->InitNonBlocking(socket->GetSocketFD());
socket->NoDelay();
socket->KeepAlive();
socket->SetSocketBufSize(96L * 1024L);
socket->SetTask(this);
this->SetTimer(120*1000);
for(int i=0;i<MSG_PACKED_ONCE_NUM;++i)
{
m_packedNewMsg.add_msgs();
}
for(int i=0;i<MSG_PACKED_ONCE_NUM;++i)
{
m_packedSeqnMsg.add_msgs();
}
for(int i=0;i<MSG_PACKED_ONCE_NUM;++i)
{
m_packedDataMsg.add_msgs();
}
}
示例2: Init
void MRTTransferSession::Init()
{
TCPSocket* socket = this->GetSocket();
socket->Open();
socket->InitNonBlocking(socket->GetSocketFD());
socket->NoDelay();
socket->KeepAlive();
socket->SetSocketBufSize(96L * 1024L);
this->SetTimer(120*1000);
}
示例3: ConnHttpHost
bool RTHttpSender::ConnHttpHost(const std::string& addr, const unsigned short port, const std::string& host)
{
SetHttpHost(host);
TCPSocket* socket = this->GetSocket();
if (socket->Open() != OS_NoErr) {
LE("%s socket->Open failed!!!\n", __FUNCTION__);
return false;
}
socket->InitNonBlocking(socket->GetSocketFD());
socket->NoDelay();
socket->SetSocketBufSize(96L * 1024L);
socket->SetTask(this);
this->SetTimer(5*1000);
OS_Error err;
do{
sleep(1);
err = socket->Connect(SocketUtils::ConvertStringToAddr(addr.c_str()), port);
LI("Connect to http server %s:%u, waiting...\n", addr.c_str(), port);
}while(!(err==OS_NoErr || err==EISCONN));
//socket->RequestEvent(EV_RE);
LI("%s addr:%s, port:%u\n", __FUNCTION__, addr.c_str(), port);
return true;
}