当前位置: 首页>>代码示例>>C++>>正文


C++ IpAddress::set方法代码示例

本文整理汇总了C++中IpAddress::set方法的典型用法代码示例。如果您正苦于以下问题:C++ IpAddress::set方法的具体用法?C++ IpAddress::set怎么用?C++ IpAddress::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IpAddress的用法示例。


在下文中一共展示了IpAddress::set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char* argv[])
{
    InitModuleObjects();
    EnableSEHtoExceptionMapping();

    if (argc<6)
    {
        usage();
        return 0;
    }

    try
    {
        const char *filename = argv[1];
        Owned<IDaliCapabilityCreator> cc = createDaliCapabilityCreator();
        cc->setSystemID(argv[2]);
        cc->setServerPassword(argv[3]);
        for (unsigned i=4;i<argc;i++) {
            const char *cmd = argv[i++];
            if (i==argc)
                break;
            const char *param = argv[i];
            if (stricmp(cmd,"THORWIDTH")==0) {
                cc->setLimit(DCR_ThorSlave,atoi(param));
            }
            else if (stricmp(cmd,"DALINODE")==0) {
                StringBuffer mac;
                if (strchr(param,'.')) { // must be ip
                    IpAddress ip;
                    ip.set(param);
                    if (!getMAC(ip,mac)) {
                        printf("ERROR: could mot get MAC address for %s\n",param);
                        return 1;
                    }
                }
                else
                    mac.append(param);
                cc->addCapability(DCR_DaliServer,mac.str());
            }
            else {
                printf("ERROR: unknown command %s\n",cmd);
                return 1;
            }
        }
        StringBuffer results;
        cc->save(results);
        Owned<IFile> ifile = createIFile(filename);
        Owned<IFileIO> ifileio = ifile->open(IFOcreate);
        ifileio->write(0,results.length(),results.str());
        printf("Dali Capabilities sucessfully exported to %s\n", filename);
    }
    catch (IException *e)
    {
        EXCLOG(e);
        e->Release();
    }

    releaseAtoms();
    return 0;
}
开发者ID:AlexLuya,项目名称:HPCC-Platform,代码行数:60,代码来源:capexport.cpp

示例2: accept

 Status TcpSocket::accept(socket_details::socket_t &peer, IpAddress &remoteAddress) {
     socket_details::sockaddr_t addr;
     unsigned int addrLen = sizeof(addr);
     peer = ::accept(mHandle, reinterpret_cast<sockaddr*>(&addr), &addrLen);
     if(peer < 0) {
         return getLastError();
     }
     remoteAddress.set(addr);
     return net::Ok;
 }
开发者ID:Bifido,项目名称:NetworkingProgramming,代码行数:10,代码来源:Socket.cpp

示例3: recv

 net::Status UdpSocket::recv(void *data, size_t buffer_size, size_t &received, IpAddress &from) {
     if (data == NULL) {
         received = 0;
         return Error;
     }
     socket_details::sockaddr_t addr = socket_details::create_address(0, 0);
     unsigned int addr_len = sizeof(addr);
     ssize_t ret = ::recvfrom(handle(), static_cast<char *>(data), buffer_size, 0,
                              reinterpret_cast<::sockaddr *>(&addr), &addr_len);
     if (ret < 0) {
         return getLastError();
         received = 0;
     } else {
         received = static_cast<size_t>(ret);
         from.set(addr);
     }
     return Ok;
 }
开发者ID:Bifido,项目名称:NetworkingProgramming,代码行数:18,代码来源:Socket.cpp


注:本文中的IpAddress::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。