本文整理汇总了C++中Csock::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ Csock::Close方法的具体用法?C++ Csock::Close怎么用?C++ Csock::Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Csock
的用法示例。
在下文中一共展示了Csock::Close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UserCommand
//.........这里部分代码省略.........
if(!CZNC::Get().WriteConfig() && !bForce) {
PutStatus("ERROR: Writing config file to disk failed! Aborting. Use " +
sCommand.AsUpper() + " FORCE to ignore.");
} else {
CZNC::Get().Broadcast(sMessage);
throw CException(bRestart ? CException::EX_Restart : CException::EX_Shutdown);
}
} else if (sCommand.Equals("JUMP") || sCommand.Equals("CONNECT")) {
if (!m_pNetwork) {
PutStatus("You must be connected with a network to use this command");
return;
}
if (!m_pNetwork->HasServers()) {
PutStatus("You don't have any servers added.");
return;
}
CString sArgs = sLine.Token(1, true);
CServer *pServer = NULL;
if (!sArgs.empty()) {
pServer = m_pNetwork->FindServer(sArgs);
if (!pServer) {
PutStatus("Server [" + sArgs + "] not found");
return;
}
m_pNetwork->SetNextServer(pServer);
// If we are already connecting to some server,
// we have to abort that attempt
Csock *pIRCSock = GetIRCSock();
if (pIRCSock && !pIRCSock->IsConnected()) {
pIRCSock->Close();
}
}
if (GetIRCSock()) {
GetIRCSock()->Quit();
if (pServer)
PutStatus("Connecting to [" + pServer->GetName() + "]...");
else
PutStatus("Jumping to the next server in the list...");
} else {
if (pServer)
PutStatus("Connecting to [" + pServer->GetName() + "]...");
else
PutStatus("Connecting...");
}
m_pNetwork->SetIRCConnectEnabled(true);
return;
} else if (sCommand.Equals("DISCONNECT")) {
if (!m_pNetwork) {
PutStatus("You must be connected with a network to use this command");
return;
}
if (GetIRCSock()) {
CString sQuitMsg = sLine.Token(1, true);
GetIRCSock()->Quit(sQuitMsg);
}
m_pNetwork->SetIRCConnectEnabled(false);
PutStatus("Disconnected from IRC. Use 'connect' to reconnect.");
return;