This question stemmed from reading a new HTTP server implmentation posted over here: http://forums.netdui...her-web-server/
It made me realize I've seen a common thread in most (all?) of the HTTP server implementations I've seen for the Netduino. They all seem to just do a single read off the socket in order to get the request. But... what if it takes more than one?
In non-netduino applications for work (Windows Server 2003/2008 environments), I've seen what should be one 16-30 byte packet come to us as one byte at a time (so we had to call "Read" 16-30 times, appending to a buffer, looking for the appropriate packet terminator or byte count, depending on the protocol). Admittedly, one byte at a time is the extreme case, but I have seen it happen. It all depends on what is on the other end talking to you, and the network topology in between.
But like I side, I don't think I've seen a single HTTP implementation which takes that into account. The one I'm currently using does not. I also do not think I've seen the problem expose itself to me.
Maybe this is just because the Netduino's typical environment (home WiFi/ethernet networks) are a bit more reliable than the field-networks I interact with at work (which may include RS232/RS485 or fiber segments mixed in)?
I guess I'm trying to decide if this is really a concern worth trying to implement. Thoughts?
Expecting entire packet in one Socket read
Started by Cabadam, Feb 19 2012 02:53 PM
1 reply to this topic
#1
Posted 19 February 2012 - 02:53 PM
#2
Posted 19 February 2012 - 06:54 PM
It's certainly not correct to assume that a complete request can be consumed in a single receive operation. We also have seen situations in real life where bytes trickled in one by one. I already wondered whether typical Netduino environments don't suffer from this problem in practice, or the problem is simply rare enough that no one appears to be affected.But like I side, I don't think I've seen a single HTTP implementation which takes that into account.
But for the record, my Web server for Getting Started with the Internet of Things takes this into account (content section of method Gsiot.Server.HttpServer.HandleRequest)
Cuno
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users