Muuj: Actually, TCP is built on top of IP, so is UDP. I wouldn''t say TCP is built on top of UDP, because that is an implementation-specific detail that you probably don''t know, and shouldn''t care about. (not you specifically, "you" as in the application programmer)
mtaber: How would you manually flush the stream? I don''t personally know of any way to do it. TCP imposes a delay for nagling, and another delay for acknowledgements. Combined, those delays can easily be as high as 250 ms in some implementations. Note, however, that nagling can be turned off (but not delayed acks). Making sure you have MTU-sized messages when you call each send() is also a helpful way to get your data through the buffers, although it still doesn''t mean it will be intact for a single receive.
quote:
"People don''t want to admit they don''t know how to do something, so they promote the easiest way around it."
No, people don''t like when other people just assume they don''t know how to do something and then go on and on about it.
KalvinB, please stop. I dedicated 17 words to UDP in my original post, you are the only one going on and on about it.
Melraiden:
UDP wouldn''t necessarily be more appropriate here, but it more closely resembles what it seems the original poster was expecting (receiving message boundaries in tact). If you want to know more, search google for: nagle, delayed ack, congestion avoidance and inherent latency. You should find a couple weeks worth of reading...