dcmqrscp 支持IP地址

6 篇文章 0 订阅

 

dcmqrscp默认只支持hostname

简单的修改了一下就可以支持IP了

dul.cc

receiveTransportConnectionTCP

 

  OFString client_dns_name;
    char client_ip_address[20];
    sprintf(client_ip_address, "%-d.%-d.%-d.%-d",  // this code is ugly but thread safe
       ((int) from.sa_data[2]) & 0xff,
       ((int) from.sa_data[3]) & 0xff,
       ((int) from.sa_data[4]) & 0xff,
       ((int) from.sa_data[5]) & 0xff);

    if (! dcmDisableGethostbyaddr.get()) remote = gethostbyaddr(&from.sa_data[2], 4, 2);
    //@20190617 to supported IP
    //if (remote == NULL)
    {
        // reverse DNS lookup disabled or host not found, use numerical address
        OFStandard::strlcpy(params->callingPresentationAddress, client_ip_address,
          sizeof(params->callingPresentationAddress));
        OFStandard::strlcpy((*association)->remoteNode, client_ip_address, sizeof((*association)->remoteNode));
    }
    //else
    //{
    //    client_dns_name = remote->h_name;

    //    char node[128];
    //    if ((*network)->options & DUL_FULLDOMAINNAME)
    //        OFStandard::strlcpy(node, remote->h_name, sizeof(node));
    //    else {
    //        if (sscanf(remote->h_name, "%[^.]", node) != 1)
    //            node[0] = '\0';
    //    }

    //    OFStandard::strlcpy((*association)->remoteNode, node, sizeof((*association)->remoteNode));
    //    OFStandard::strlcpy(params->callingPresentationAddress, node, sizeof(params->callingPresentationAddress));
    //}

 

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值