On Thursday 02 March 2006 1:54 pm, Anders Johansson wrote:
Jerry Feldman wrote:
I would use either write(2), read(2), send(2), or recv(2) directly.
Why?
The issue is one of buffering, timing and control, especially when doing network programming. part of the problem is that fputs(3) writes the string to a user space buffer. This buffer does not get flushed until you either fill the buffer or flush the buffer using fflush(3). In this case, you may not detect I/O problems until well after the fact.
It is not wrong to use C streams, but you will see these delays in things, like receiving the EOF on fputs(3). You certainly can handle it, but you are at a different level of abstraction.