[Symbian-hacks] Socket Programming sucks ass
Christopher Schmidt
Tue Jan 17 09:11:34 EST 2006
After spending some quality time with my code yesterday afternoon, I
realized that all the GPS implementations yet seen suffer from the same
problem: tehy can fall far behind the current data. My code suffers much
more heavily than Nick's code to this trap, because I'm sleeping and
only updating every 10 seconds, so I fall way farther behind, whereas
his code may actually be keeping up with the GPS.
Here's the problem:
* Connect to socket
* Read socket data
* Update display (This takes time, during which more data builds up in
the socket)
* Read more data from socket.
In the last step, you're not actually reading the most current data from
the socket. You're reading what built up while you were updating the
display.
The way to fix this is to somehow "clear" the socket. One way to do this
would be to do some kind of "read all" function, using the select
module... however, 'm having lots of problems actually doing this. What
seems like it should work just doesn't.
I'll keep people updated, but just wanted to mention this as it's a
relatively important issue for socket programming in general, and one
that I completely forgot about.
--
Christopher Schmidt
Mobile Application Developer
More information about the Symbian-hacks
mailing list