Jan
25
2009

FYP Technology: SO_RCVBUF

I spent all day yesterday trying to get the jerky movement out my accelerometer->PC graphics data stream. First I changed out the standard winsock code on the PC with Boost’s ASIO stream sockets. Didn’t change anything… and building the Boost libraries took a long time: I had to uninstall the VS2008 compiler so it would use the VS2005 compiler as environment setting scripts weren’t changing anything, so I ended up building everything 3 times.

Next I changed out the NSNetService streams on the iPod with standard unix sockets… still the same problems.

What made me figure out how to get it working was when I made a dummy server in Xcode and it worked fine… it must be a Windows thing. Sure enough, it was. I enabled TCP_NODELAY and changed SO_RCVBUF to 128 bytes and it’s working! I think I might be getting a buffer underrun though, as even though I ask for 12 bytes, I get 10 and everything falls apart after a hundred or so recv() calls. SO_RCVLOWAT is 1 by default, which means that if 12 bytes are requested, but only 1 is available, you’ll only get 1. The lower of SO_RCVLOWAT and the requested amount is what you get. So, I set SO_RCVLOWAT pretty high (over 100), but the problem didn’t go away. I think I’ll try changing the send buffer size (SO_SNDBUF) on the iPod and see how that affects things.

Until then, I shall leave you with a song by Japanese 80s hit sensation, BOOWY:

Written by in: University |

No Comments »

RSS feed for comments on this post. TrackBack URL


Leave a Reply

Powered by WordPress | Theme: Aeros 2.0 by TheBuckmaker.com