Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Sep 2002 16:42:25 +0300
From:      Peter Pentchev <roam@ringlet.net>
To:        Vladimir Terziev <vladimirt@rila.bg>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Problems catching SIGPIPE when writing to a broken stream
Message-ID:  <20020923134225.GD361@straylight.oblivion.bg>
In-Reply-To: <20020923163418.216b14ae.vladimirt@rila.bg>
References:  <20020923163418.216b14ae.vladimirt@rila.bg>

next in thread | previous in thread | raw e-mail | index | archive | help

--+HP7ph2BbKc20aGI
Content-Type: text/plain; charset=windows-1251
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Sep 23, 2002 at 04:34:18PM +0300, Vladimir Terziev wrote:
>=20
> 	Hi hackers,
>=20
> 	I'm implementing a programmme, which writes a big amount of data (using =
write(2)) to a socket.
> 	When the communication stream has been closed by some reason, during the=
 write(2) call, my process receives SIGPIPE. I tryed to catch it with signa=
l(3) and change the behaviour of write(2) call with siginterrupt(3), but SI=
GPIPE is still raised to my process and terminates it.
>=20
> 	Any help and ideas will be useful!

You should receive a short write(2) before the SIGPIPE is sent, most
probably a write() which returns -1 and sets errno to, say, ECONNRESET
or something like that.  Are you sure *all* your previous writes return
as many bytes as you have tried to write?

G'luck,
Peter

--=20
Peter Pentchev	roam@ringlet.net	roam@FreeBSD.org
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
If I were you, who would be reading this sentence?

--+HP7ph2BbKc20aGI
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iD8DBQE9jxpA7Ri2jRYZRVMRAhSKAJ43PVomkgifAyDgKG66vjoT4RsNFACfVxS8
BIp1Ffo0iIcBVmC6O9umEzY=
=0HMe
-----END PGP SIGNATURE-----

--+HP7ph2BbKc20aGI--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020923134225.GD361>