View previous topic :: View next topic |
Author |
Message |
anders_aj
Joined: 15 Feb 2013 Posts: 2
|
Posted: Fri Feb 15, 2013 11:51 am Post subject: upnpDiscover returns only one device, pNext is always null |
|
|
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 |
|
 |
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1587
|
Posted: Sat Feb 16, 2013 9:03 am Post subject: |
|
|
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.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
 |
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1587
|
|
Back to top |
|
 |
anders_aj
Joined: 15 Feb 2013 Posts: 2
|
Posted: Tue Feb 19, 2013 9:43 am Post subject: |
|
|
Cool thanks, I'll look into that. |
|
Back to top |
|
 |
|