本文整理汇总了C++中IpAddress::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ IpAddress::isNull方法的具体用法?C++ IpAddress::isNull怎么用?C++ IpAddress::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IpAddress
的用法示例。
在下文中一共展示了IpAddress::isNull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: appendDropZones
//For every ECLWatchVisible dropzones, read: dropZoneName, directory, and, if available, computer.
//For every Servers/Server in ECLWatchVisible dropzones, read: directory,
// server name, and hostname(or IP). Create dropzone("@name", "@directory", "@computer",
// "@netAddress", "@linux", "@sourceNode") tree into pSoftware.
void CFileSpraySoapBindingEx::appendDropZones(double clientVersion, IConstEnvironment* env, const char* dfuwuidSourcePartIP, IPropertyTree* softwareTree)
{
Owned<IConstDropZoneInfoIterator> dropZoneItr = env->getDropZoneIterator();
ForEach(*dropZoneItr)
{
IConstDropZoneInfo& dropZoneInfo = dropZoneItr->query();
if (!dropZoneInfo.isECLWatchVisible()) //This code is used by ECLWatch. So, skip the DZs not for ECLWatch.
continue;
SCMStringBuffer dropZoneName, directory, computerName;
dropZoneInfo.getName(dropZoneName);
dropZoneInfo.getDirectory(directory);
if (!dropZoneName.length() || !directory.length())
continue;
bool isLinux = getPathSepChar(directory.str()) == '/' ? true : false;
Owned<IConstDropZoneServerInfoIterator> dropZoneServerItr = dropZoneInfo.getServers();
ForEach(*dropZoneServerItr)
{
IConstDropZoneServerInfo& dropZoneServer = dropZoneServerItr->query();
StringBuffer name, server, networkAddress;
dropZoneServer.getName(name);
dropZoneServer.getServer(server);
if (name.isEmpty() || server.isEmpty())
continue;
IPropertyTree* dropZone = softwareTree->addPropTree("DropZone", createPTree());
dropZone->setProp("@name", dropZoneName.str());
dropZone->setProp("@computer", name.str());
dropZone->setProp("@directory", directory.str());
if (isLinux)
dropZone->setProp("@linux", "true");
IpAddress ipAddr;
ipAddr.ipset(server.str());
ipAddr.getIpText(networkAddress);
if (!ipAddr.isNull())
{
dropZone->addProp("@netAddress", networkAddress);
if (!isEmptyString(dfuwuidSourcePartIP))
{
IpAddress ip(dfuwuidSourcePartIP);
if (ip.ipequals(ipAddr))
dropZone->addProp("@sourceNode", "1");
}
}
}
}
}
示例2: listen
bool TcpServer::listen(const IpAddress& address, uint16_t port)
{
if(address.isNull())
return false;
int fd = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in addr;
bzero(&addr, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
inet_pton(AF_INET, address.toString().c_str(), &addr.sin_addr);
if(bind(fd, (struct sockaddr *)&addr, sizeof(addr)) == 0)
{
setServerAddress(address);
setServerPort(port);
setSocketDescriptor(fd);
if(::listen(fd, SOMAXCONN) == 0)
return true;
}
return false;
}