Re: C++, stdout, and XInetd

From: Joshua Kugler <jk@as.uaf.edu>
Date: Thu Apr 29 2004 - 11:40:02 AKDT

Well, wasn't that interesting.

I figured that that a call to QSqlDatabase::addDatabase was clearing the=20
signal handlers. =A0So, I moved my signal() call to *after* my call to=20
addDatabase. =A0Now everything works just peachy. =A0A bug in Qt? =A0Probab=
ly not.

I posted this to the Qt list, and someone replied that the database lib was=
=20
probably setting up its own handlers. =A0So, I have a message out on the My=
SQL=20
list asking about that.

Thanks for everyone's help. =A0It was much appreciated!

Troy: Thanks for the example from the Qt docs. =A0I was doing effectively t=
hat,=20
but it wasn't being caught. =A0It is now, and it exits nicely. =A0Thanks!

j----- k-----

On Wednesday 28 April 2004 11:22 pm, Joshua Kugler wrote:
> Well, I've figured it out, somewhat.
>
> When the client disconnects, a SIGPIPE ends up getting sent to the server
> (the program xinetd invoked). I tried setting up a handler in my program,
> but it didn't seem to be getting invoked. So, I did a stripped down test
> program (without any Qt stuff), and it *would* work. So, I have a message
> in to the Qt mailing list asking why the Qt library is intercepting
> SIGPIPE.
>
> Thanks for all your help everyone! I'll let you know what I find out.
>
> j----- k-----
>
> On Wednesday 28 April 2004 10:36 pm, Troy Melhase wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > On Wednesday 28 April 2004 09:51 pm, Joshua Kugler wrote:
> > > Well, I'm not using any special library, really. The way xinetd works
> > > is that it connects stdin to the input stream and stdout to the output
> > > of the program it invokes. So, I'm just using cout to print to the
> > > client.
> >
> > Okay, I think I understand what you're doing. But what I don't
> > understand is this: which one of these endpoints, the "server" program
> > or the socket client, is supposed to decide when the message or
> > conversation or is complete?
> >
> > I think that answer, along with how you have the service configured in
> > the xinetd.conf file will point to a solution. Is the service flagged =
as
> > KEEPALIVE? I notice that man xinetd.conf says this:
> >
> > REUSE The REUSE flag is deprecated. All services
> > now implicitly use the REUSE flag.
> >
> > > I'm using Qt, so I've even tried using a QFile and QIOStream and
> > > opening stdout, but even when the client disconnects, QFile::isOpen()
> > > still reports true. Very odd.
> >
> > I don't know how useful closing stdout would be. Can you shut the
> > process down?
> >
> > - --
> > Troy Melhase, troy@gci.net
> > - --
> > I am the Christian the Devil warned you about.
> >
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.2.4 (GNU/Linux)
> >
> > iD8DBQFAkKJjY7QSTRCBoM4RAicdAKC7CpE2GihP/SrTkxhFE6QRmqr3ywCffrMl
> > CO+2yAtoEnCPG7V5g8He/10=3D
> > =3DWyF8
> > -----END PGP SIGNATURE-----
> > ---------
> > To unsubscribe, send email to <aklug-request@aklug.org>
> > with 'unsubscribe' in the message body.

=2D-=20
Joshua Kugler
Assistant Systems Administrator
UAF Department of Mathematical Sciences
UAF LUG President

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Thu Apr 29 11:40:20 2004

This archive was generated by hypermail 2.1.8 : Thu Apr 29 2004 - 11:40:23 AKDT