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 

upnpDiscover returns only one device, pNext is always null

 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpc Bugs
View previous topic :: View next topic  
Author Message
anders_aj



Joined: 15 Feb 2013
Posts: 2

PostPosted: Fri Feb 15, 2013 11:51 am    Post subject: upnpDiscover returns only one device, pNext is always null Reply with quote

Hi all

I am trying to use miniupnp to find my network cameras. I followed the guide from a post by Maya Posch. Can't link as this is my first post.

I got it working, except that the upnpDiscover function returns a device list where the pNext pointer is always null. I have 3 cameras connected, and it also differs which one is found. But always only 1 is found.

Here is my code:
Code:
    WSADATA wsaData;
    int nResult = WSAStartup(MAKEWORD(2,2), &wsaData);
    if(nResult != NO_ERROR) {
        cout << "Winsock Error: " << nResult << endl;
    }

    UPNPDev * devlist = 0;
    const char* multicastif = 0;
    const char* minissdpdpath = 0;
    int error;

    devlist = upnpDiscover(3000, multicastif, minissdpdpath, 0, 0, &error);
    cout << "error: " << error << endl;

    for (; devlist != NULL; devlist = devlist->pNext)
    {
        cout << "device url: " << devlist->descURL << endl;
        cout << "Next device: " << devlist->pNext << endl;
    }


Have any of you encountered this or what am I doing wrong?

Kind regards, Anders
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1469

PostPosted: Sat Feb 16, 2013 9:03 am    Post subject: Reply with quote

upnpDiscover() is not designed to find all UPNP devices on the network.
You should modify the function in order to send the right M-SEARCH request for your devices, and wait sufficient time to get response for all.
_________________
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: 1469

PostPosted: Sat Feb 16, 2013 9:51 am    Post subject: Reply with quote

I have made a branch on github :
https://github.com/miniupnp/miniupnp/tree/search_all/miniupnpc

patch https://github.com/miniupnp/miniupnp/commit/9f1a9a91e63230cb57c8c33a7a1041b7dbe50be0
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
anders_aj



Joined: 15 Feb 2013
Posts: 2

PostPosted: Tue Feb 19, 2013 9:43 am    Post subject: Reply with quote

Cool thanks, I'll look into that.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpc Bugs 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.