Can not call a webpage from my Fez Panda device

Hi,

i want to call a webpage from my FezPanda (issue a GET request to a url).
I’ve developed some basic app’s from Visual Studio 2010 (.Net MF 4.18) so i know my Fez board is working.

What i want to do now is to send a GET request to a webpage/url, but i can’t get it to work.

I’ve read that you should configure the network settings first, via the MFDeploy tool. But, when connected in the MFDeploy tool, when i select the menu option to open that window, i get an error (invalid configuration) from the MFdeploy tool.

So now i’ve tried to setup the network settings myself, with the code from the ‘internet book of things’ (the example where you host a socket listener / webserver on the Fez.)
But this didn’t work either: when i want to read the content of the response of the HttpWebClient ( or the WebClient) i get a ‘NotSupportedException’.

But i don’t know what is not supported?

I’ve read that it is the DNS resolver giving me a problem, but i also tried a piece of code (man did i try a lot of code examples…) where the DNS was set on a different way and it could actualy resolve the IPAddres of the url, but i got the same notsupportedexception.

I’ve also seen an example which sends an email via a socket connection, but i did not understand enough of it to rewrite it that the code would send a GET request and not some mail commands…

Can anyone proivde me with some sample code?

I also reflashed the FEZ but the MFeploy still didn’t let me open up the network settings (and besides that, it struck me as weird that i had to use an external tool to setup the network parameters, that i can not do it from code?)

Regards,
Michel

[quote]I’ve read that you should configure the network settings first, via the MFDeploy tool. But, when connected in the MFDeploy tool, when i select the menu option to open that window, i get an error (invalid configuration) from the MFdeploy tool.
[/quote]

That is the case on everything except panda, which has limited virtual stack that is built in C# to use Wiznet chipset.

[quote]So now i’ve tried to setup the network settings myself, with the code from the ‘internet book of things’ (the example where you host a socket listener / webserver on the Fez.)
But this didn’t work either: when i want to read the content of the response of the HttpWebClient ( or the WebClient) i get a ‘NotSupportedException’.
[/quote]

The examples as is give exception? They should run fine if not modified.

The book you are using has many examples and there are more on codeshare but I recommend the book fist as it is targeted for your setup.

[quote]I also reflashed the FEZ but the MFeploy still didn’t let me open up the network settings (and besides that, it struck me as weird that i had to use an external tool to setup the network parameters, that i can not do it from code?)
[/quote]

MFDeploy does not work with panda, beside fro ping and check firmware version.

The question is, how are you connecting your panda to the network? Do you own a FEZ Connect (discontinued product)?

Welcome to the community.

Hi,

i’m using 4.18
I think i’ve read that my device is too old to be updated to version 4.2
(http://wiki.tinyclr.com/index.php?title=NETMF_4.1_to_4.2):
USBizi (panda/domino): 4.1 and undecided on 4.2 support
I’m using the firmware which was installed on my disk by the SDK.

I’ve executed most of the examples from ‘the internet of things’

@ Gus -
Thanks for letting me know the MFDeploy does not work, that wil save me hours of retrying tonight :slight_smile:

To be more clear about the example: the example itself from ‘the internet of things’, namely the hosting of the webserver, works as a charm.
The Fez acts as a webserver and i can connect to it on my local LAN from my PC.

About connecting to the ‘outside world’: i’ve read the book ‘the internet of things’ back and forward, but i couldn’t find an example to issue a GET request to an external server, did i overlook anything?
The only example i saw was about sending an email, but that was via a socket and as i wrote earlier i could not get that rewritten to issue a GET request to and external server

To be specific, i want to do a GET to for example www.myserver.com/addData?year=2013&month=1 etc.

@ andre.marschalek Panda is 4.1 device.

@ nerdmichel What shield do you use to connect to the internet?

@ Architect -

http://www.ghielectronics.com/catalog/product/261

Fez connect shield

Ok. Have you tried this sample client code example from GHI?

http://www.tinyclr.com/codeshare/entry/227

@ Architect - Thought i did, but i’m not sure.
Gonna try that tonight when i’m at home…

Yes, lets make sure that example works first.

@ Architect -
I was crossing fingers, hopes were up and all sort of things… but unfortunately no luck.
It did however produce the same error as yesterday.

I did notice however that 4.18 as versionumber which is mentioned was not the correct, you can see the right versions in the output.

One thing about the code: the was one small compile issue, i had to provide a hostname to this line of code:
Dhcp.EnableDhcp(mac);
I changed it to:
Dhcp.EnableDhcp(mac,“”);

The debug output:

Rebooting…
Create TS.
Loading start at 4eb34, end 56d0c
Attaching file.
Assembly: mscorlib (4.1.2821.0) (3880 RAM - 33236 ROM - 19134 METADATA)
Loading Deployment Assemblies.
Attaching deployed file.
Assembly: Microsoft.SPOT.IO (4.1.2821.0) (740 RAM - 4620 ROM - 2522 METADATA)
Assembly: Microsoft.SPOT.Net.Security (4.1.2821.0) (264 RAM - 1220 ROM - 606 METADATA)
Assembly: Microsoft.SPOT.Net (4.1.2821.0) (704 RAM - 5060 ROM - 2452 METADATA)
Attaching deployed file.
Assembly: System.Http (4.1.2821.0) (2976 RAM - 38160 ROM - 12831 METADATA)
Assembly: GHIElectronics.NETMF.Hardware (4.1.8.0) (1268 RAM - 8732 ROM - 5109 METADATA)
Assembly: Microsoft.SPOT.Hardware (4.1.2821.0) (1752 RAM - 11440 ROM - 7371 METADATA)
Assembly: FEZ Panda II Application (1.0.0.0) (484 RAM - 2704 ROM - 1030 METADATA)
Assembly: GHIElectronics.NETMF.W5100.Dhcp (4.1.8.0) (448 RAM - 4936 ROM - 1093 METADATA)
Assembly: System (4.1.2821.0) (872 RAM - 5992 ROM - 3206 METADATA)
Assembly: System.Net.Security (4.1.2821.0) (664 RAM - 4544 ROM - 1943 METADATA)
Assembly: Microsoft.SPOT.Native (4.1.2821.0) (1144 RAM - 6516 ROM - 4479 METADATA)
Assembly: FEZPanda_II_GHIElectronics.NETMF.FEZ (4.1.8.0) (304 RAM - 904 ROM - 495 METADATA)
Assembly: GHIElectronics.NETMF.W5100 (4.1.8.0) (1028 RAM - 11556 ROM - 4106 METADATA)
Assembly: GHIElectronics.NETMF.System (4.1.8.0) (488 RAM - 2496 ROM - 1465 METADATA)
Total: (14836 RAM - 142116 ROM - 67842 METADATA)
The debugging target runtime is loading the application assemblies and starting execution.
Ready.

‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\mscorlib.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\Microsoft.SPOT.Native.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\Microsoft.SPOT.Hardware.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\Microsoft.SPOT.IO.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\Microsoft.SPOT.Net.Security.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\Microsoft.SPOT.Net.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\System.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\System.Net.Security.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\System.Http.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\GHI Electronics\GHI NETMF v4.1 SDK\Assemblies\le\GHIElectronics.NETMF.System.dll’
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\GHI Electronics\GHI NETMF v4.1 SDK\Assemblies\le\GHIElectronics.NETMF.Hardware.dll’
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\GHI Electronics\GHI NETMF v4.1 SDK\Assemblies\le\GHIElectronics.NETMF.W5100.dll’
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\GHI Electronics\GHI NETMF v4.1 SDK\Assemblies\le\GHIElectronics.NETMF.W5100.Dhcp.dll’
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘R:\projects\trunk\NetMicro\Probeersels\LichtMeten\bin\Debug\le\FEZ Panda II Application.exe’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\GHI Electronics\GHI NETMF v4.1 SDK\Assemblies\le\FEZPanda_II_GHIElectronics.NETMF.FEZ.dll’
The thread ‘’ (0x2) has exited with code 0 (0x0).

Network settings:
IP Address: 192.168.178.19
Subnet Mask: 255.255.255.0
Default Getway: 192.168.178.1
DNS Server: 212.54.40.25

GC: 3msec 37668 bytes used, 26712 bytes available
Type 0F (STRING ): 984 bytes
Type 11 (CLASS ): 5640 bytes
Type 12 (VALUETYPE ): 552 bytes
Type 13 (SZARRAY ): 2784 bytes
Type 15 (FREEBLOCK ): 26712 bytes
Type 16 (CACHEDBLOCK ): 72 bytes
Type 17 (ASSEMBLY ): 17088 bytes
Type 18 (WEAKCLASS ): 144 bytes
Type 19 (REFLECTION ): 24 bytes
Type 1B (DELEGATE_HEAD ): 252 bytes
Type 1D (OBJECT_TO_EVENT ): 96 bytes
Type 1E (BINARY_BLOB_HEAD ): 5424 bytes
Type 1F (THREAD ): 384 bytes
Type 20 (SUBTHREAD ): 48 bytes
Type 21 (STACK_FRAME ): 1968 bytes
Type 22 (TIMER_HEAD ): 72 bytes
Type 27 (FINALIZER_HEAD ): 96 bytes
Type 31 (IO_PORT ): 108 bytes
Type 34 (APPDOMAIN_HEAD ): 72 bytes
Type 36 (APPDOMAIN_ASSEMBLY ): 1860 bytes
#### Exception System.NotSupportedException - CLR_E_NOT_SUPPORTED (1) ####
#### Message:
#### System.Net.Dns::GetHostEntry [IP: 0008] ####
#### System.Net.HttpWebRequest::EstablishConnection [IP: 00e1] ####
#### System.Net.HttpWebRequest::SubmitRequest [IP: 0013] ####
#### System.Net.HttpWebRequest::GetResponse [IP: 000c] ####
#### LichtMeten.Program::PrintHttpData [IP: 0016] ####
#### LichtMeten.Program::Main [IP: 007a] ####
A first chance exception of type ‘System.NotSupportedException’ occurred in System.dll
#### Exception System.Net.WebException - 0x00000000 (1) ####
#### Message:
#### System.Net.HttpWebRequest::GetResponse [IP: 00d3] ####
#### LichtMeten.Program::PrintHttpData [IP: 0016] ####
#### LichtMeten.Program::Main [IP: 007a] ####
A first chance exception of type ‘System.Net.WebException’ occurred in System.Http.dll
Exception in HttpWebRequest.GetResponse(): System.Net.WebException

Ok. Lets try to figure this out. First of all you said Panda, but I see dlls for Panda II. So which is it Panda or Panda II?

@ Architect - Ehm, so i think i made a mistake…

it’s the Panda 2, i looked at the bottom.

I just never thought of the ‘2’, just the Panda, sorry…

Ok. Remove System.Http reference from your project. It doesn’t exists on Panda II.

@ Architect - When i remove the System.Http reference, the using System.Net; can not be found, and from that missing using, the HttpWebRequest can not be found…

when i add only the usings from the code example

using System;
using System.IO;
using System.Text;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.Net;
using GHIElectronics.NETMF.Net.NetworkInformation;

The HttpWebRequest can not be resolved?

@ nerdmichel - Please see in the screenshot the list of references for that example from codeshare.

@ Architect - YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS!

You made me, and my wife who had to put up with me being grumpy :slight_smile: very happy!

It was this reference which i was missing:

GHIElectronics.NETMF.W5100.Http

And normally i’m a big fan of resharper, but this time it was too eager to satisfy my needs, because when it saw a webrequest defined, it immediately suggested the System.Http.

And me, being happy that the object was found, accepted the suggestion, and so that reference cam into my project, and i did not see any need to look further for another dll for another webrequest class.

Thank you VERY much for all the effort you spent on my question!

For other people: this example works, when you use the Webrequest from the GHIElectronics.NETMF.W5100.Http DLL and not the System.Http dll

You are welcome!