Hi,
This is regarding WSDiscovery APIs provided by WS4D-GSoap stack. I have followed reference manual, ws4d-gsoap-refman.pdf provided in GSoap kit. In this document section 6.11.3.4 there is descrption how to find WSD devices of specific type, on the network.
Following is the C routine, I wrote based on that. It discovers the devices on the network but the program hangs at the following statement
dpws_done() (made bold in the C routine below) - printing
"corrupt list node" in the console. Can you please let me know what is wrong here.?
Thanks
Raveesh
void WSDiscovery_demo()
{
//////////////////// Start Discovery ///////////////////////
int ret;
int timeout = 3000;
struct dpws_s dpws1;
struct ws4d_epr device1;
struct ws4d_abs_eprlist results;
ws4d_qnamelist type_list;
ws4d_alloc_list alist1;
char *XAddrs1 = NULL;
dpws_init(&dpws1, "10.208.24.83");
ws4d_eprlist_init (&results, ws4d_eprllist_init, NULL);
WS4D_ALLOCLIST_INIT (&alist1);
ws4d_qnamelist_init (&type_list);
ws4d_qnamelist_addstring
("\"
http://schemas.microsoft.com/windows/2006/08/wdp/print/PrinterServiceType\"",
&type_list, &alist1);
ret = dpws_probe (&dpws1, &type_list, NULL, timeout, 1000, NULL, NULL, &results);
if (ret != SOAP_OK)
{
if (ret == SOAP_EOF)
{
//No device matches
}
else
{
//Internal error when probing for devices
}
}
else
{
struct ws4d_epr * temp = results.fget_first(&results);
printf("\nDiscovered device address : %s Service Name :%s Port Name :%s \n", temp->Address, temp->ServiceName,
temp->PortName);
ws4d_epr_init (&device1);
ws4d_epr_set_Addrs (&device1, temp->Address);
// resolve address
XAddrs1 = (char *) dpws_resolve_addr(&dpws1, &device1, NULL, 10000);
if (XAddrs1 != NULL)
{
printf("WSD Print client: device %s found at addr %s\n\n",
ws4d_epr_get_Addrs(&device1), XAddrs1);
}
while(1)
{
temp = results.fget_next(&results, temp);
if(temp != NULL)
{
printf("\nDiscovered device address : %s Service Name :%s Port Name :%s \n", temp->Address, temp->ServiceName,
temp->PortName);
ws4d_epr_init (&device1);
ws4d_epr_set_Addrs (&device1, temp->Address);
XAddrs1 = (char *) dpws_resolve_addr(&dpws1, &device1, NULL, 10000);
if (XAddrs1 != NULL)
{
printf("WSD Print client: device %s found at addr %s\n\n",
ws4d_epr_get_Addrs(&device1), XAddrs1);
}
}
else
break;
}
//work with results here
}
ws4d_qnamelist_done (&type_list);
dpws_done(&dpws1); // Program hangs here printing "corrupt list node" on the console
ws4d_eprlist_done (&results);
ws4d_epr_reset(&device1);
ws4d_alloclist_done(&alist1);
///////////////////////////////////////////// End Discovery ////////////////////////////
}