本文整理汇总了C++中SocketClient::openSocket方法的典型用法代码示例。如果您正苦于以下问题:C++ SocketClient::openSocket方法的具体用法?C++ SocketClient::openSocket怎么用?C++ SocketClient::openSocket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SocketClient
的用法示例。
在下文中一共展示了SocketClient::openSocket方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool
SocketRegistry<T>::reconnect(const char * host) {
for(Uint32 i=0; i < m_nSocketClients; i++) {
SocketClient * socketClient = m_socketClients[i];
if(strcmp(socketClient->gethostname(), host)==0) {
if(!socketClient->isConnected()) {
if(socketClient->openSocket() > 0)
return true;
else return false;
}
}
}
return false;
}
示例2: SocketClient
bool
SocketRegistry<T>::createSocketClient(const char * host, Uint16 port) {
if(port == 0)
return false;
if(host==NULL)
return false;
SocketClient * socketClient = new SocketClient(host, port);
if(socketClient->openSocket() < 0 || socketClient == NULL) {
ndbout << "could not connect" << endl;
delete socketClient;
return false;
}
else {
m_socketClients[m_nSocketClients] = socketClient;
m_nSocketClients++;
}
return true;
}