This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to find out if socket closed?


On Tue, Jul 15, 2003 at 03:16:02PM -0600, Gary Thomas wrote:

> > > If I submitted a patch (to the old stack) adding an ioctl that
> > > returned the SS_CANTRECVMORE flag, what are the chances of it
> > > being accepted?
> > 
> > Here's a patch that adds an option for getsockopt() to retrieve
> > the state of the SS_CANTRCVMORE flag.  The current
> > implimentation of getsockopt(SO_ERROR) seemed to be the closest
> > thing I could find to what I was adding, so that's where it went.
> 
> A better question is "how is this solved elsewhere?"  E.g. how
> can one tell what's happening with a socket on Linux?

AFAICT, there are two options for detecting that in Linux:

 1) you get sent a SIGHUP.
 
 2) you can use poll() and ask for POLLHUP events on the file
    descriptor.

> It would be nice to have a solution which matches other systems.
> If it turns out that this is a special case, then your patch seems
> OK, but I'd also like to see it for the new stack as well.

I don't yet have a working build with the new stack, but it's
on my list of things to do.

-- 
Grant Edwards
grante@visi.com

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]