miniupnp.tuxfamily.org Forum Index miniupnp.tuxfamily.org
The forum about miniupnp and libnatpmp
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

upnpDiscoverDevices only return one device

 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> NAT/UPnP
View previous topic :: View next topic  
Author Message
ingar



Joined: 20 May 2015
Posts: 1
Location: Kongsberg

PostPosted: Wed May 20, 2015 11:06 am    Post subject: upnpDiscoverDevices only return one device Reply with quote

Hi,

I'm adding upnp discovery to one of my applications using the static linked library. My problem is that I am searching for 2 (for now) different types of devices, but the upnpDiscoverDevices only return one. upnpDiscoverAll returns all devices on my network as expected.

I run the following code:
Code:

int main(void)
{
    const char * multicastif = 0;
    const char * minissdpdpath = 0;
    int error = 0;
    struct UPNPDev * devlist = 0;
    struct UPNPDev * dev;
    char type[64];
    char * const devList[] = {
        "urn:schemas-upnp-org:device:ZonePlayer:1",
        "urn:schemas-upnp-org:device:Y-cam Cube HD720 White:1",
        0
    };

    devlist = upnpDiscoverDevices((const char * const *)devList, 4000, multicastif, minissdpdpath, 0, 0, &error);

    if (devlist)
    {
        for (dev=devlist;dev!=NULL; dev = dev->pNext)
        {
            printf("%-48s\t%s\n", dev->st, dev->descURL);
        }
        freeUPNPDevlist(devlist);
    }
    else
    {
        printf("No devices found\n");
    }

    return 0;
}


Both devices are normally connected to my network, in which case only the one that is connected first is found. If I disconnect the first one, the other one is found. Reconnect both, the one connected last is not found.

error does not indicate an error...

Anything I'm missing here?

Thanks,

Ingar
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1452

PostPosted: Fri May 22, 2015 9:40 am    Post subject: Reply with quote

there is indeed a bug in upnpDiscoverDevices(), the device list is returned as soon as the 1st device is detected.
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1452

PostPosted: Fri May 22, 2015 11:04 am    Post subject: Reply with quote

try with the latest changes : https://github.com/miniupnp/miniupnp/commit/5c6a140098665ad78f93667d141f55564e575c57
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> NAT/UPnP All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP
© 2007 Thomas Bernard, author of MiniUPNP.