*BSD News Article 60798


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.bhp.com.au!mel.dit.csiro.au!munnari.OZ.AU!news.ecn.uoknor.edu!news.cis.okstate.edu!news.ksu.ksu.edu!news.physics.uiowa.edu!math.ohio-state.edu!howland.reston.ans.net!news.nic.surfnet.nl!tuegate.tue.nl!news.win.tue.nl!charm.il.ft.hse.nl!not-for-mail
From: robert@il.ft.hse.nl (Robert Klep)
Newsgroups: comp.unix.bsd.freebsd.misc,comp.os.linux.development.apps
Subject: Re: Checking for a closed socket connection
Date: 29 Jan 1996 12:24:12 +0100
Organization: LSD...melts in your mind, not in your hand
Lines: 11
Message-ID: <4eiaos$42l@charm.il.ft.hse.nl>
References: <NEWTNews.822505959.29723.jalvarez@sundev.uno.com> <4e7l8n$50f@charm.il.ft.hse.nl> <4effu2$ega@phoenix.ea4els.ampr.org>
NNTP-Posting-Host: charm.il.ft.hse.nl
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:13348 comp.os.linux.development.apps:11707

sjmudd@phoenix.ea4els.ampr.org (Simon J Mudd):
 >Robert Klep (robert@il.ft.hse.nl) wrote:
 >> read() to/write() from it and see if the function returns a -1 :)
 >is it acceptable therefore to read 0 bytes, or write 0 bytes?

I read an old doc about read() last week, and it seems that it's very
OS-dependent what read() will return in certain cases. My guess is that
checking for 0-or-lower as return-value is best to check a 'hang-up' of
the remote server.

                                                                robert