My problem with fdopen and sockets........

Chris Torek chris at mimsy.UUCP
Fri Feb 17 02:50:40 AEST 1989


In article <9556 at cit-vax.Caltech.Edu> wen-king at cit-vax.Caltech.Edu
(King Su) writes:
>in  = fdopen(soc,"r");
>out = fdopen(soc,"w");

If you use this technique, be aware that fclose(in) also closes out's
file descriptor, without giving it a chance to flush any pending data.
Likewise, fclose(out) closes in's fd.  There is also no guarantee that
stdio will not get upset if fclose's implied close() fails.  This
might, for instance, lead to running out of FILE structures.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.wizards mailing list