HelloWorldServer_MF Project

Hello,

I have a FEZ Cobra and attempted to deploy (via Visual Studio) the ‘HelloWorldServer_MF project from the ‘Microsoft .NET Micro Framework 4.1\Samples folder. I received the following error:

An unhandled exception of type ‘System.Net.Sockets.SocketException’ occurred in Microsoft.SPOT.Net.dll

Any ideas?

On what API call did the exception occur? Was there any other information with the exception?

Did you set your network settings? MAC, IP…etc.

I have not set the mac address (I accepted the default). Is this a requirement? I accepted the default ip which worked on my network and I was able to ping.

MAC should be preset. You need to set IP, Gateway, DNS, and subnet.

I can ping the device. Doesnt this tell me that the settings are ok?

Additionally, the error message above is all the feedback I get. Maybe I should set a breakpoint at the entry point of the application. Perhaps this might tell me more.

Thanks guys

This is FEZ…this means you can debug,…step in code…view variables …see exactly what is going on…and ti is still freakin’ easy :wink:

Simpy saying “I have an exception” will not be very helpful :slight_smile: Where did the exception happen?

Well, if you know your routers IP you can confirm your settings. Gateway/DNS are both going to be the routers IP. The device IP is whatever you want it to be.

[quote]On what API call did the exception occur? Was there any other information with the exception?
[/quote]

I think the ebook may need a section on basic debugging techniques and how to ask for help on the forum.

Is there some sort of forum protocol I should be aware of? I thought my questions/comments were clear.

No protocol. All you had to do was answer Mike’s question.

We are all eager and happy to help you but at the same time we need you to give answers so we can help you better.

He asked you twice actually :slight_smile:

The exception is thrown at line 77 of ‘HelloWCFServerApp.cs which is ‘Device.Start(ctx);

Thanks again for your time.

During a restart of the FEZ Cobra I received the following through MFDeploy:

Start DPWS device service with endpoint address: ‘urn:uuid:18571766-87df-06e2-bb68-5136c48f483f’
#### 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] ####
#### Dpws.Device.Program::Start [IP: 008a] ####
#### Dpws.Device.Program::Main [IP: 0033] ####
#### SocketException ErrorCode = 10049
Uncaught exception

Here are lines last three lines of code up to the exception:

System.Ext.Console.Write( "Start DPWS device service with endpoint address: '" + Device.EndpointAddress + "'" );

ServerBindingContext ctx = new ServerBindingContext(version);

// Start the device
Device.Start(ctx);  //Exception happens here

I apologize if I unnecessarily wasted any of your time earlier.

Have you checked all items in the Readme.txt?

Especially these line

I have checked the example on my cobra and the exception didn’t occur :frowning:

[quote]The thread ‘’ (0x2) has exited with code 0 (0x0).
Start DPWS device service with endpoint address: 'urn:uuid:18571766-87df-06e2-bb68-5136c48f483f’
The thread ‘’ (0x1) has exited with code 0 (0x0).
[/quote]

Have you changed something in the code? Or have you only compiled and deployed?

I have the same problem. When I try to execute that example I get the same error at the same line:

[quote]Start DPWS device service with endpoint address: ‘urn:uuid:18571766-87df-06e2-bb68-5136c48f483f’
#### 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] ####
#### Dpws.Device.Program::Start [IP: 008a] ####
#### Dpws.Device.Program::Main [IP: 0033] ####
#### 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]

In my case, I am not able to ping the device using MFDeploy tool, but I can ping it from a command shell. I have just installed the 4.1 firmware to the device and configured the network properties the same way I had before (it used to work perfectly with 4.0). I am using an Embedded Master Development Board with EMX firmware.

I think that means it can’t get out to the internet. You do have MFDeploy setup correctly, right? Gateway/DNS are your router’s IP, Subnet mask is 255.255.255.0.

Those are typical home settings, anyway.

I believe that they indeed forgot to edit their settings in mfdeploy.

Here’s how to do it:

Here are the settings displayed, change these to your needs

Foekie, you need to also set at least your primary DNS.