#### Exception System.NullReferenceException - CLR_E_NULL_REFERENCE (3) ####
#### Message:
#### ChipworkXWEBServer.Program::bsc_lanForm [IP: 0008] ####
#### ChipworkXWEBServer.WebServer::ThreadProc [IP: 0283] ####
A first chance exception of type 'System.NullReferenceException' occurred in ChipworkX Application.exe
#### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (7) ####
#### Message:
#### Microsoft.SPOT.Net.SocketNative::poll [IP: 0000] ####
#### System.Net.Sockets.Socket::Poll [IP: 0011] ####
#### System.Net.Sockets.Socket::Accept [IP: 0017] ####
#### System.Net.HttpListener::AcceptThreadFunc [IP: 0020] ####
#### SocketException ErrorCode = -1728053248
#### SocketException ErrorCode = -1728053248
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll
#### SocketException ErrorCode = -1728053248
#### SocketException ErrorCode = -1728053248
The thread '<No Name>' (0x7) has exited with code 0 (0x0).
Exception was thrown: System.NullReferenceException
8
9
#### Exception System.Net.ProtocolViolationException - 0x00000000 (3) ####
#### Message: Invalid HTTP request String:
#### System.Net.HttpListenerRequest::ParseHTTPRequest [IP: 003e] ####
#### System.Net.HttpListenerContext::get_Request [IP: 000d] ####
#### ChipworkXWEBServer.WebServer::ThreadProc [IP: 003e] ####
A first chance exception of type 'System.Net.ProtocolViolationException' occurred in System.Http.dll
Socket already closed
#### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (8) ####
#### Message:
#### Microsoft.SPOT.Net.SocketNative::poll [IP: 0000] ####
#### System.Net.Sockets.Socket::Poll [IP: 0011] ####
#### System.Net.Sockets.Socket::Accept [IP: 0017] ####
#### System.Net.HttpListener::AcceptThreadFunc [IP: 0020] ####
#### SocketException ErrorCode = -1728053248
#### SocketException ErrorCode = -1728053248
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll
#### SocketException ErrorCode = -1728053248
#### SocketException ErrorCode = -1728053248
The thread '<No Name>' (0x8) has exited with code 0 (0x0).
The program '[13] Micro Framework application: Managed' has exited with code 0 (0x0).
problem is when I directly access to web page which need some POST data. For example if I send from some other site POST data all is ok. If for example I wan’t check if there is some POST data then I get exception…
Code:
Loooooool Thanks Wouter Huysentruit I don’t know how I didn’t try this simple comparation instead of looking for count or some other method
Now work ok
This WebServer extension is great thing I can combine images from SD card together with html from Resources…
One question:
What all I can use in my HTML code?
Can I use:
HTML
CSS
PHP
JavaScript(jQuery, AJAX…)
Or are here some limits what we can use for making pages?
So if I understand right for example I make HTML file put it on desktop and open it from firefox. If work normaly without installed any HTTP server then it will also work on cobra?
Wouter Huysentruit Thanks.
Strings in POST work ok What I would like is that I from POST get file and save it to SDcard.
For example:
User can now when we have BinaryResponse save configuration file from device to HDD(Like router’s configuration) and then I would like have option to save it back to device(Like router’s load configuration from HDD option)…
Then the webserver will receive form-data encoded block which I need to process in a different way as I do now.
To keep the current concept, I’ll have to buffer the data in memory, which means that the size of the uploaded data will be limited to, let’s say, 256Kbyte. Is that a problem?
I already using enctype= “multipart/form-data” so I will leave it as it is
My current config file have size 1,33 KB (1.368 B) and it will not increase a lot. Maybe few KB but it will be under limitation. Is maybe possible make this buffer configurable(for example in WEBServer.cs some constant like current POST comannds)?
Thanks for your time and help.
Hi. Again me
I have another question:
1.)Is possible add option for permited IP addresses whcih have access to webpage? For example:
If we use webserver.permitedIP = “0.0.0.0” then all IP addresses have access to web page.
If we use webserver.permitedIP = “192.168.1.11” then only 192.168.1.11 IP address have access to web page.
If we use webserver.permitedIP = “192.168.1.11;192.168.1.12;192.168.1.13” then only 192.168.1.11, 192.168.1.12 and 192.168.1.13 IP address have access to web page.
If we use webserver.permitedIP = “192.168.1.0” then all 192.168.1.XXX IP address have access to web page.
If user who doesn’t have permited IP access connect to webpage receive default error page(maybe new option like:
webserver.ErrorPage(new WebServer.EventCallback(error_page));
I’m a little stuck with that multipart thing.
The post data of a multipart block is seperated by a textual boundary.
I have a loop that searches the index of all boundaries inside the received data. But man, it is slow! It only processes 700bytes per second! So if you send a file of 15K it takes more then 20 seconds to find the boundaries…
// Scanning input for boundaries
Queue boundaryOffsets = new Queue();
int matchLength = 0;
for (int i = 0; i < dataLength; i++)
{
if (data[i] == (byte)boundary[matchLength++])
{
if (matchLength == boundary.Length)
{
// Found match
boundaryOffsets.Enqueue(i - (matchLength - 1));
matchLength = 0;
}
}
else
{
if (matchLength > 0)
i -= (matchLength - 1);
matchLength = 0;
}
}
Does anyone know of a faster way of doing this?
I can use RLP for that, but then the WebServer class is not that plug&play anymore.
@ Wouter Huysentruit: If there is no way to speed-up thing then is better to have slow one than nothing We will not upload firmware files by web browser so 1kb/s will be good for smal configuration files(few kb)…
Sorry if this is a stupid question
Is it possible to use html files from an SD card (by using the virtual directory option) and insert active content into the static files ?
That is possible if you modify the WebServer class
Anyway, I would suggest you host a static website with client-side scripting (use a javascript framework like jquery or prototype). This way you can have the client-size scripting requesting values from the webserver that you handle with a callback.