FEZWiFi example

I’m trying to get the example program FEZWiFi working. Everything seems to work until the program gets to ResourceManager.GetObject call in the Resources class. A System.ArgumentException occurred in mscorlib.dll. I am at a standstill on how to solve this exception.

Did you add the resource you need?http://docs.ghielectronics.com/software/tinyclr/tutorials/resources.html

Thanks, that suggestion got me a little bit further. Now I get an unhandled exeception of type ‘System.InvalidOperationException’ occurred in GHIElectronics.TinyCLR.Drivers.STMicroelectronics.SPWF04Sx.dll
Additional information: Unexpected payload.

Apparently the exception occurred in routine TestSocket when wifi.OpenSocket was called.
Again, thanks for the help.

There is a very recent thread on this forum with a lot of info. For example, it talks about giving the module time to connect

Did you try to open a TLS secured socket or without security?
I would first try without TLS:
TestSocket(“www.ghielectronics.com”, “/robots.txt”, 80, SPWF04SxConnectionType.Tcp, SPWF04SxConnectionSecurityType.None);

Thanks for your suggestion. I still got the same exception. I’m fairly new at this network stuff and am just trying to get the example project FEZWiFi to work. Could this exception have anything to do with certificates?

I think it is the best if you show your code and perhaps only use the TestSocket call I mentioned above.

I’m new to these forums. What would be the avenue for me to show you my code?

Copy and paste. If you then type some (I think 4) spaces at the beginning of a line it is formated as code.
Please try to keep it short.

my code is the FEZWiFi project from /github.com/ghi-electronics/TinyClr-Samples. I didn’t add/change anything.

I would first try without TLS:
comment out this line:

include this line in the while loop and comment out all the other calls:

TestSocket(“www.ghielectronics.com”, “/robots.txt”, 80, SPWF04SxConnectionType.Tcp, SPWF04SxConnectionSecurityType.None);

the call to wifi.OpenSocket resulted in following exception:

Exception System.Exception - 0x00000000 (1)

#### Message: Request failed
#### GHIElectronics.TinyCLR.Drivers.STMicroelectronics.SPWF04Sx.SPWF04SxInterface::OpenSocket [IP: 0083] ####
#### FEZWiFi_1.Program::TestSocket [IP: 001a] ####
#### FEZWiFi_1.Program::Main [IP: 00f8] ####

Exception thrown: ‘System.Exception’ in GHIElectronics.TinyCLR.Drivers.STMicroelectronics.SPWF04Sx.dll
Request failed

Some questions:
Did you make the firmware update of the WiFi module?
Did you leave enough time (try 20 sec) before pressing BTN1 to led the module scan and than connect to the router?
Did you see the messages WIND: WiFiUp 0:xxx.xxx.xxx.xxx (Ip-Address)
and WIND: NtpServerDelivery 2019.3.21… ?

Yes, to all three of your questions.

Don’t know why it doesn’t work for you, here the same code works. Something with your WiFi Network? Repeater? Firewall?
You could download the WiFi driver from Github and use this instead of the .dll. Then you can set breakpoints inside the driver.
If you want you can download and try my App -https://github.com/RoSchmi/AzureDataSender_FEZ which uses the GHI driver with little modifications.

I get errors building your app since the files that are referenced in your resources are missing on my computer.

Debugging the OpenSocket routine in the driver, I find that var a is always “\r\n” which is what causes the exception. My guess is that this string comes from the router.

That is the Ip-Address of the url you want to access, that is correct

Do you have any idea why a socket wan’t opened?

Is it valid to have cr and nl in url?

Is port 0 valid?