As it seems from code runTCPServer registers socket close 
and TCPClient runs it in bracket so all open resources should be
closed. It my last try I add 
  _ <- register $ killThread tId
after forking serverSrc $$ clientSink, to kill outter thread explicilty
otherwise it closes thread with error. 

> Is this the expected behaviour or are resources not being closed?

In 'strace' log it seems that both sockets is closed. So I think that 
computation is closed before reaching the end because src $$ sink closed
with error. If you want to run action at the end you can register it

--
Alexander V Vershilov


Sat, Mar 10, 2012 at 05:43:12AM +0000, grant wrote
> I've tried running the code with runTCPServer first but I get
>  "recv: invalid argument (Bad file descriptor)" on ubuntu (virtualbox) 
> and when running on windows 
> I get "Network.Socket.ByteString.recv: failed (Unknown error)".
> 
> Also, it seems odd that when I run this code   
> https://gist.github.com/2010354   
> that it doesn't print "END   serverSrc clientSink". 
> Is this the expected behaviour or are resources not being closed?
> Again the same thing happens when running on Ubuntu.
> 
> {- here is the output ...
> C:\haskell>netproxy4
> START clientSrc serverSink
> START serverSrc clientSink
> END   clientSrc serverSink
> START serverSrc clientSink
> START clientSrc serverSink
> END   clientSrc serverSink
> -}
> 
> Thanks for any ideas.
> Grant
> 
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to