本文整理汇总了C++中MythSocket::state方法的典型用法代码示例。如果您正苦于以下问题:C++ MythSocket::state方法的具体用法?C++ MythSocket::state怎么用?C++ MythSocket::state使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MythSocket
的用法示例。
在下文中一共展示了MythSocket::state方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: strlist
MythSocket *MythCoreContext::ConnectEventSocket(const QString &hostname,
int port)
{
MythSocket *eventSock = new MythSocket();
while (eventSock->state() != MythSocket::Idle)
{
usleep(5000);
}
// Assume that since we _just_ connected the command socket,
// this one won't need multiple retries to work...
if (!eventSock->connect(hostname, port))
{
LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to connect event "
"socket to master backend");
eventSock->DecrRef();
return NULL;
}
eventSock->Lock();
QString str = QString("ANN Monitor %1 %2")
.arg(d->m_localHostname).arg(true);
QStringList strlist(str);
eventSock->writeStringList(strlist);
bool ok = true;
if (!eventSock->readStringList(strlist) || strlist.empty() ||
(strlist[0] == "ERROR"))
{
if (!strlist.empty())
{
LOG(VB_GENERAL, LOG_ERR, LOC +
"Problem connecting event socket to master backend");
}
else
{
LOG(VB_GENERAL, LOG_ERR, LOC +
"Timeout connecting event socket to master backend");
}
ok = false;
}
eventSock->Unlock();
if (ok)
{
eventSock->setCallbacks(this);
}
else
{
eventSock->DecrRef();
eventSock = NULL;
}
return eventSock;
}