- From: Thomas Dreibholz <dreibh AT iem.uni-due.de>
- To: "À̺°ÀÓ" <starim AT telcoware.com>
- Cc: discussion AT sctp.de
- Subject: Re: [SCTP-Discussion] stdin, stdout, stderr in SCTP
- Date: Thu Aug 25 14:42:10 2005
- List-id: SCTP Discussions <discussion.sctp.de>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday 25 August 2005 13:31, À̺°ÀÓ wrote:
>
Hello..
>
I have some questions about SCTP.
>
>
I was testing some application over SCTP layer
>
with sctplib(1.0.1) and socketapi(1.3.1)
>
(SCTP was running over Solaris 2.8 and compiled with gcc,
>
my program was compiled with cc)
>
>
when I closed all opened fd (included stdin, stdout, stderr) and then ran
>
my program, but my program was not working correctly.
Did you close stdin, stdout and stderr with fclose() or ext_close(FILENO_...)?
If you use fclose(), this will use the close() system call internally in the
libc. Therefore, the socket API will not be aware that you closed the
descriptor. If you use ext_close(), the socket API will close the std... FD
but the libc is not aware of the closure. That is, it still assumes that
stdin, stdout and stderr are usable. Furthermore, the C++ IO streams cout,
cin and cerr also independently refer to the std... FDs.
In summary, closing stdin, stdout and stderr usually is not recommended. Does
your program really need to close these FDs?
Best regards
- --
=======================================================================
Dipl.-Inform. Thomas Dreibholz
University of Essen, Room ES210
Inst. for Experimental Mathematics Ellernstraße 29
Computer Networking Technology Group D-45326 Essen/Germany
- -----------------------------------------------------------------------
E-Mail:
dreibh AT exp-math.uni-essen.de
Homepage:
http://www.exp-math.uni-essen.de/~dreibh
=======================================================================
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFDDbxF32BbsHYPLWURAtqlAKDdBUDVg2EbOe7hbwRMH3D4T1hKvACgo2sW
Edp+nc+uvGk91yBeleF0QJM=
=86Ge
-----END PGP SIGNATURE-----
Archive powered by MHonArc 2.6.19+.