I am trying to host a DPWS service on my Gadgeteer device that will be consumed by a WCF client. I have everything working when I use the 4.1 Emulator, but when I try to deploy the code to the Gadgeteer I receive the folloiwng error (when debugging the deployment):
#### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (1) ####
#### Message:
#### Microsoft.SPOT.Net.SocketNative::sendto [IP: 0000] ####
#### System.Net.Sockets.Socket::SendTo [IP: 0022] ####
#### System.Net.Sockets.Socket::SendTo [IP: 000a] ####
#### Dpws.Device.Discovery.DpwsDiscoGreeting::SendGreetingMessage [IP: 0087] ####
#### Dpws.Device.Device::Start [IP: 0020] ####
#### Program::startMyService [IP: 00a6] ####
#### Program::ProgramStarted [IP: 0076] ####
#### Program::Main [IP: 0015] ####
#### SocketException ErrorCode = 10049
#### SocketException ErrorCode = 10049
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll
#### SocketException ErrorCode = 10049
An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll
I have also tried the sample code (HelloWorldServer_MF) that comes with the 4.1 SDK but I receive the same error. Is this related to the Gadgeteer? If there was a 4.2 Gadgeteer firmware out I would try 4.2 to see if the problem is still present … thanks!
All I personally know is that DPWS is rarely used and it is possible that it has some issues. Also, NETMF4.2 did some fixes in this area, which is planned to be available Q1/2012.
Hi There,
i just decided to play with the DPWS so i loaded the HelloWorldServer_MF sample that came with the .netMD SDK… which worked great on the emulator but when taken to the spider i got the exception error… and the reason for the error was simply the WRONG IP Address…
in the sample code they were looking to 0.0.0.0 but the GHI Spider for some reason has a default IP set to 192.168.1.200 which i recommend GHI to replace by 0.0.0.0… maybe it is something we can do here… anyway: the current CODE:
while (true)
{
ni = NetworkInterface.GetAllNetworkInterfaces()[0];
if (ni.IPAddress != "0.0.0.0") break;
Thread.Sleep(1000);
}
must be replaced with :
while (true)
{
ni = NetworkInterface.GetAllNetworkInterfaces()[0];
ni.EnableDhcp(); //Enabled DHCP...
if (ni.IPAddress != "0.0.0.0" & ni.IPAddress != "192.168.1.200") break; //Chekc for the default IP before you continue.
Thread.Sleep(1000);
}
Thanks Jay Jay … Unfortunetly my setup does not include a router or hub that will assign a DHCP address and when I call EnableDHCP() I get an exception (I think it times out since there is not DHCP server).