I build a little Client/Server application with my FEZ Spider.
The FEZ acts as the client and transmitts a picture from the camera module to a WPF Server App.
This is done using the WiFi RS21 module and NETMF sockets. It works very well but the speed is very bad:-(
I’ve already reduced the resolution of the camera, but transfering the picture, which is about 57KB, takes about 5s.
On the server side I can see that the packets “drop” in with 1460 Bytes/s. I know that this is caused by the MTU size, but I would expect that there could be more than 1 packet transmitted per second. My Router tells me, that the FEZ is connected with 65MBit.
I’m quite new to the Gadgeteer/NETMF world and maybe this is normal behavior. Could it be caused by the implementation of the TCP/IP stack?
I hope, someone has already done something similar and can give me some hints.
How many bytes are you sending at a time? It sounds like maybe a lot…
I’d try to break it up into 1k sends and see if it improves. It could be that you’re forcing the stack to do lots of extra work by having it do the fragmenting and that’s causing it to slow way down.
Hello ddurant.
Sorry for that quick reply. I thought, I could use that button for code formatting:-(
So here is the code, that sends the picture:
Debug.Print(DateTime.Now + ": Sending picture. Please wait...");
var start = new TimeSpan(DateTime.Now.Ticks);
socket.Send(pictureData);
var finished = new TimeSpan(DateTime.Now.Ticks);
var duration = finished - start;
Debug.Print("Sending picture took " + duration.Milliseconds + "ms");
btSend.ToggleLED();
Debug.Print(DateTime.Now + ": Send complete.");
So you can see that I send all bytes at once. The Debug.Print() statement, that gives me the time in ms for the socket.Send() statement, shows me about 500ms at runtime.
So the rest of the total transmission time must be spend in the Socket? Stack?. I don’t know. I can give it a try an split up the packets in 1KB chunks, but I think that won’t help much, because the Send() complets very fast and the rest is part of the network.
5s for 57KB, I would say that’s about 10kbs.
@ Mike
No. There is no image conversion. I’m sending the raw data. The conversion is done on the server side.
@ Gus
Yes. It’s a very nice little system and I’m very happy with it:-)
Because I don’t have any experience with these kind of devices I’m only interested if my values are plausible, and if I might have been done something wrong.
If that is the speed I can get, than it’s ok.
I took a quick look in my server and here are the values:
For a complete picture with a resolution of 176x144 pixels the server has to receive 76086 bytes.
The size of about 57KB, I was telling you, was a test I made before. Sorry for that.
So to transfer the 76086 bytes it takes about 5 seconds.