@ andre.m -
at the end you have a working ip address and no socket problems if you use the code from ghi, or not?
I do not think I know how to answer you question directly.
I do know that when I run the sample code âas isâ (That means I have not made changes to the original code posted by Gus)
I application runs without failure showing the Debug.Print messages. My router DHCP List always shows the same IP address 192.168.2.5.
Method wifi_NetworkAddressChanged(object sender, EventArgs e) is called only once.
I am not sure what you mean by âno socket problemsâ - Not the brightest blub in the light fixture hereâŚ
Unless you mean a socket between the application WiFi and my wireless router. To me (I assume) that socket is created
somewhere inside the GHINET.NetworkInterfaceExtension⌠I know nothing about what sockets the interface usesâŚ
Like I have said before. Using the sample code my router always shows that the WiFi module IP in in itâs DHCP list.
As a side note: I have/use McAfee and if I look at their âMy Networkâ is also shows it connected.
EDIT: Created a snapshot of McAfee showing IP
I can say (from my point of view) that something is still not working. Even though it shows I have a good IP from DHCP.
(I admit it very well could be my code but I have not been able to create a simple web request without errors).
I used the sample code as a base and added some code that worked on my Spider (Using the Redpine WiFi module for Gadgeteer) and that does not work).
I used the sample code as a base because it said it was made for Cobra II (which I am using). I want it to work for GHI AND me!
Iâll keep out of it until I find a specific reason for the errors that boil down to receving multiple events after using HttpWebRequest request.GetResponse().
I receive⌠error SocketException ErrorCode = 10054 and then I start receiving three NetworkChangeExtension_NetworkAddressChanged events.
!!! are my Debug messages
!!! ERROR: Inner:System.Net.WebException: connection failed
!!! Exit SetupWebEvent()
!!! EXIT wifi_NetworkAddressChanged 1
!!! WirelessConnectivityChanged-------
!!! Enter wifi_NetworkAddressChanged 2
!!! NetworkAddressChanged WiFideviceIP = 0.0.0.0 Count: 2
!!! ERROR IP not correct 0.0.0.0 Count:2
!!! Enter wifi_NetworkAddressChanged 3
!!! NetworkAddressChanged WiFideviceIP = 192.168.2.5 Count: 3
!!! Calling SetupWebEvent()
!!! Enter SetupWebEvent()
!!! HttpWebRequest is using url: http://192.168.2.5:80/cobrawifi
!!! Inside try HttpWebRequest request.GetResponse()
#### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (4) ####
#### Message:
#### Microsoft.SPOT.Net.SocketNative::connect [IP: 0000] ####
#### System.Net.Sockets.Socket::Connect [IP: 001d] ####
#### System.Net.HttpWebRequest::SubmitRequest [IP: 0019] ####
#### System.Net.HttpWebRequest::GetResponse [IP: 000c] ####
#### GadgeteerTestWiFiWeb.Program::SetupWebEvent [IP: 0099] ####
#### GadgeteerTestWiFiWeb.Program::wifi_NetworkAddressChanged [IP: 005d] ####
#### GHI.Premium.Net.NetworkInterfaceExtension::NetworkChangeExtension_NetworkAddressChanged [IP: 0021] ####
#### GHI.Premium.Net.NetworkChangeExtension::OnNetworkChangeCallback [IP: 00ac] ####
#### GHI.Premium.Net.NetworkChangeExtension+NetworkChangeExtensionListener::OnEvent [IP: 000d] ####
#### Microsoft.SPOT.EventSink::EventDispatchCallback [IP: 0014] ####
#### SocketException ErrorCode = 10054
#### SocketException ErrorCode = 10054
A first chance exception of type âSystem.Net.Sockets.SocketExceptionâ occurred in Microsoft.SPOT.Net.dll
#### SocketException ErrorCode = 10054
#### SocketException ErrorCode = 10054
#### Exception System.Net.WebException - 0x00000000 (4) ####
#### Message: connection failed
#### System.Net.HttpWebRequest::EstablishConnection [IP: 0168] ####
#### System.Net.HttpWebRequest::SubmitRequest [IP: 0019] ####
#### System.Net.HttpWebRequest::GetResponse [IP: 000c] ####
#### GadgeteerTestWiFiWeb.Program::SetupWebEvent [IP: 0099] ####
#### GadgeteerTestWiFiWeb.Program::wifi_NetworkAddressChanged [IP: 005d] ####
#### GHI.Premium.Net.NetworkInterfaceExtension::NetworkChangeExtension_NetworkAddressChanged [IP: 0021] ####
#### GHI.Premium.Net.NetworkChangeExtension::OnNetworkChangeCallback [IP: 00ac] ####
#### GHI.Premium.Net.NetworkChangeExtension+NetworkChangeExtensionListener::OnEvent [IP: 000d] ####
#### Microsoft.SPOT.EventSink::EventDispatchCallback [IP: 0014] ####
A first chance exception of type âSystem.Net.WebExceptionâ occurred in System.Http.dll
#### Exception System.Net.WebException - 0x00000000 (4) ####
#### Message:
#### System.Net.HttpWebRequest::GetResponse [IP: 00d3] ####
#### GadgeteerTestWiFiWeb.Program::SetupWebEvent [IP: 0099] ####
#### GadgeteerTestWiFiWeb.Program::wifi_NetworkAddressChanged [IP: 005d] ####
#### GHI.Premium.Net.NetworkInterfaceExtension::NetworkChangeExtension_NetworkAddressChanged [IP: 0021] ####
#### GHI.Premium.Net.NetworkChangeExtension::OnNetworkChangeCallback [IP: 00ac] ####
#### GHI.Premium.Net.NetworkChangeExtension+NetworkChangeExtensionListener::OnEvent [IP: 000d] ####
#### Microsoft.SPOT.EventSink::EventDispatchCallback [IP: 0014] ####
A first chance exception of type âSystem.Net.WebExceptionâ occurred in System.Http.dll
!!! ERROR: Inner:System.Net.WebException: connection failed
!!! Exit SetupWebEvent()
!!! EXIT wifi_NetworkAddressChanged 3
After receiving the errors above my router (after a refresh) still shows a valid DHCP IP
Sort of funny because I got the Cobra II to use it for a Web ApplicationâŚ
I am not trying to âfightâ anyone or say right/wrong about anything.
I am only posting what I find so that maybe the âsmartâ folks can sense what is wrong from the error list.
Iâll shut-up now
Have a GREAT day!