Mailinglist Archive: opensuse-programming (33 mails)

< Previous Next >
Re: [suse-programming-e] EAGAIN on a blocking socket?
  • From: Jerry Feldman <gaf@xxxxxxx>
  • Date: Thu, 2 Mar 2006 15:56:04 -0500
  • Message-id: <200603021556.04248.gaf@xxxxxxx>
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.
Jerry Feldman <gaf@xxxxxxx>
Boston Linux and Unix user group PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9

< Previous Next >
List Navigation