Hi I’am working on a client to communicate with a wcf webservice. Basicly all is working with the emulator :-), but when I download it to my EMX-Dev Board I get following error:
[quote] #### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (1) ####
#### Message:
#### Microsoft.SPOT.Net.SocketNative::setsockopt [IP: 0000] ####
#### System.Net.Sockets.Socket::SetSocketOption [IP: 0012] ####
#### Ws.Services.Binding.UdpTransportBindingElement::OnOpen [IP: 00ae] ####
#### Ws.Services.Binding.BindingElement::Open [IP: 0015] ####
#### Ws.Services.Binding.BindingElement::Open [IP: 000f] ####
#### Ws.Services.Binding.ReplyChannel::Open [IP: 0012] ####
#### Dpws.Client.DpwsClient::.ctor [IP: 0077] ####
#### tempuri.org.IPowerContractClientProxy::.ctor [IP: 000b] ####
#### Pps.NETMF.Power.Program::Main [IP: 00cc] ####
#### 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
[/quote]
I have googled, but nobody realy knows how to fix this error.
Maybe somewone has a example code to establish a connection with dpws. I have also looked at the sample code of the SDK but it isn’t working, same error.
µC Version: latest 4.2
wcf webservice: .net 4.0
I use ethernet to connect the devices, with a dhcp server.
You have to notice that in certain cases, the MFSCVUTIL makes somes mistakes in the way it parses your class and creates the proxy ! I had some similar errors when using classes as params or returned values.
Can you provide us with your proxy and contract implementation, so that we will probably see what goes wrong…
I don’t think you will be able to get this working on framework 4.2 until UDP is fixed (The readme lists UDP as not working). DPWS uses UDP to broadcast the service and in this case the socket is complaining of an invalid IP address (ErrorCode = 10049). I tried for most of a day to work around this, settign teh IP address and tracing it to make sure it was set correctly. Downgrading to 4.1 was an instant fix.
For reference, the 4.1 samples require you to set an IP address before you start the device otherwise you will get the exact same 10049 error in this case because the IP address really is invalid. I added the following to main:
static void Main(string[] args)
{
var network = NetworkInterface.GetAllNetworkInterfaces()[0];
if (!network.IsDhcpEnabled)
network.EnableDhcp();
network.RenewDhcpLease();
With 4.2. the 10049 is being thrown even when the ipaddress is correctly set because the UDP socket is not bound.
@ Gus - I’ve been trying to get the DPWS sample app to work, and have encountered the same errors as posted here. Can you confirm that these errors are due to the UDP bug?
We didn’t get that far yet but we know that udp didn’t work is now fixed internally so we/you will be able to test very soon. We still have couple priority items.
I downloaded the update but the same issues exist. I.e. just adding a reference to MFDpwsDevice causes the exception below. I guess it is back to 4.1 which is annoying as 4.1 doesn’t send announcements.
if you want to test it is not hard to reproduce, just drag a j11d module on to the designer and add a reference MFDpwsDevice.
Yep, same here – I am not using the Simple Service, however am using same approach to how SimpleService is built and also used MFSvcUtil.exe to generate the proxies. The exception is thrown on Dpws.Device.Device.Start:
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 am using the latest SDK updates (February) on a Spider board.
Gus said it was fixed in internal build a month ago (based on the other thread NickP). Does that mean it didn’t make it into the latest 4.2 release? I noticed in the release notes it says UDP fixed, and while I had another UDP issue that seems to be resolved now, the DPWS issue still seems to be there…