Exceptions and sockets

2001-05-02 Thread Johannes Waldmann

OK now I upgraded to ghc-5.00 but the situation didn't change.
My suspicion is that it's not the fault of `catch'.

I think what happens is this:
I `Socket.accept' a connection and get a handle.
Now, if the connections dies, but I still write to the handle,
the whole thing crashes - without throwing an exception.
(I checked that the RTS thinks  `hIsWritable h'
even if `h' does no longer exist in reality.)

How could I work around this? SocketPrim?
-- 
-- Johannes Waldmann  http://www.informatik.uni-leipzig.de/~joe/ --
-- [EMAIL PROTECTED] -- phone/fax (+49) 341 9732 204/252 --

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Exceptions and sockets

2001-05-02 Thread Volker Stolz

In local.glasgow-haskell-users, you wrote:
I `Socket.accept' a connection and get a handle.
Now, if the connections dies, but I still write to the handle,
the whole thing crashes - without throwing an exception.
(I checked that the RTS thinks  `hIsWritable h'
even if `h' does no longer exist in reality.)

Looks to me like you're forgetting that the OS will give you a
sigPIPE on (semi-)closed sockets, which translates to a segfault
unless you install a signal handler:

 - http://www.haskell.org/ghc/docs/latest/set/socket.html#AEN13989
 - socket(2)
-- 
Abstrakte Syntaxträume.
Volker Stolz * [EMAIL PROTECTED] * PGP + S/MIME

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users