From: gokeigen <go...@so...> - 2007-06-20 10:39:02
|
I have a problem when i build control point and device into one process. source code is listed down.If the function of "UpnpSendAdvertisement"is called,the control point can not download description document from mini http server.But,if "UpnpSendAdvertisement"is not called,everything is ok.what is wrong with my program? /* routine */ int upnpDeviceStart() { int ret = UPNP_E_SUCCESS; char* web_dir_path = "./web"; ret = UpnpSetWebServerRootDir(web_dir_path); if(ret != UPNP_E_SUCCESS) { ERROR_PRINTF("Specifying webserver root directory --> %s failure!\n \ Error Code : %d\n",web_dir_path,ret); upnpFinish(); return ret; } char* ip = NULL; unsigned short port; char desc_File_url[256]; char* pDesc_File_Name = "tvdevicedesc.xml"; ip = UpnpGetServerIpAddress(); port = UpnpGetServerPort(); sprintf(desc_File_url,"http://%s:%d/%s",ip,port,pDesc_File_Name); DBG_PRINTF("descfileurl --> %s\n",desc_File_url); ret = UpnpRegisterRootDevice(desc_File_url, upnpDeviceCallbackEventHandler, &deviceHandle, &deviceHandle); if(ret != UPNP_E_SUCCESS) { ERROR_PRINTF("Registering the rootdevice --> %s failure!\n \ Error Code : %d\n",&desc_File_url[0],ret); upnpFinish(); return ret; } #if 1 ret = UpnpSendAdvertisement(deviceHandle,Device_Advr_Expire); if(ret != UPNP_E_SUCCESS) { ERROR_PRINTF("Sending advertisements --> %d\n \ Error Code : %d\n",ret); upnpFinish(); return ret; } #endif return ret; } /* debug message when "UpnpSendAdvertisement" is called */ [DEBUG]upnpctrlInit(). [DEBUG]descfileurl --> http://127.0.0.1:49152/tvdevicedesc.xml cmd> [DEBUG]DISCOVERY_SEARCH_TIMEOUT [DEBUG]DISCOVERY_SEARCH_TIMEOUT Error: Error obtaining device description from http://127.0.0.1:49152/tvdevicedesc.xml [DEBUG]retCode: -207 /* wget message */ [lnkinprk@npc0705 ~]$ wget --no-proxy http://127.0.0.1:49152/tvdevicedesc.xml --19:19:18-- http://127.0.0.1:49152/tvdevicedesc.xml Connecting to 127.0.0.1:49152... connected. HTTP request sent, awaiting response... /* debug message when "UpnpSendAdvertisement" is not called */ [DEBUG]upnpctrlInit(). [DEBUG]descfileurl --> http://127.0.0.1:49154/tvdevicedesc.xml cmd> [DEBUG]Add to Device Summary:UPnP Television Emulator [DEBUG]DISCOVERY_SEARCH_TIMEOUT /* wget message */ [lnkinprk@npc0705 ~]$ wget --no-proxy http://127.0.0.1:49153/tvdevicedesc.xml --19:28:07-- http://127.0.0.1:49153/tvdevicedesc.xml Connecting to 127.0.0.1:49153... connected. HTTP request sent, awaiting response... 200 OK Length: 1532 (1.5K) [text/xml] Saving to: `tvdevicedesc.xml.4' 100%[=======================================>] 1,532 --.-K/s in 0s 19:28:07 (196 MB/s) - `tvdevicedesc.xml.4' saved [1532/1532] |