Main Site Documentation

Socket HTTP GET on Panda II


#1

Hi
I got my FEZ Panda up and running with my Seeed Ethernet Shield.
I tried running a simple HTTP server on it from codeshare, and it works perfekt.
But what i actually want to do, is sending a web request to another server, so i need it to act as a client…
Normally in windows .net Apps i would use HttpWebRequest for this, but i get a NotSupported Exception when i use this…
So i guess i need to use a pure socket connection, and then a request through this somehow?

So how would i do a simple HTTP request to a webserver fx. and get the response from the server, using just sockets? (or some other way i just dont know of?)


#2

Like i wrote i my initial post, everytime i try to use HttpWebRequest i get NotSupportedExceptopn:


 #### Exception System.NotSupportedException - CLR_E_NOT_SUPPORTED (1) ####
    #### Message: 
    #### System.Net.Sockets.Socket::.ctor [IP: 001f] ####
    #### System.Net.HttpWebRequest::EstablishConnection [IP: 0132] ####
    #### System.Net.HttpWebRequest::SubmitRequest [IP: 0013] ####
    #### System.Net.HttpWebRequest::GetResponse [IP: 000c] ####
    #### FEZ_Panda_II_Application6.Program::PrintHttpData [IP: 001c] ####
    #### FEZ_Panda_II_Application6.Program::Main [IP: 00b5] ####
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] ####
    #### FEZ_Panda_II_Application6.Program::PrintHttpData [IP: 001c] ####
    #### FEZ_Panda_II_Application6.Program::Main [IP: 00b5] ####
A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll
Exception in HttpWebRequest.GetResponse(): System.Net.WebException

Thats why im looking for another way to do a web request, unless someone know why my httpwebrequest isnt working?


#3

You need GHI implementation of that not the one that comes with NETMF


#4

Can you explain that a bit more? how i get that?


#5

You should have GHIElectronics.NETMF.W5100.Http dll in your SDK. Add reference to that dll and use HttpWebRequest from GHIElectronics.NETMF.Net namespace


#6

That worked! thanks!!


#7

You are welcome!