I have played a bit with the Network library, the “simple” form where the use is fairly easy: a combination of ‘listenOn’, ‘connectTo’, ‘accept’ and we have something working. Now I am trying to use the “real” thing, meaning Network.Socket and Network.Socket.ByteString because I’d like to send files between a client and a server. But it is not as easy to use as the higher level interface and I’m looking for some code examples and/or how-tos. Particularly, the code dealing with ‘getAddrInfo’, ‘AddrInfo’ and ‘SockAddr’ I don’t understand very deeply.
So, where can I get this type of resource?
I have played a bit with the Network library, the simple form where the
Share
I can just show an own example:
I don’t test (just cut from my code file) so maybe fails in the imports. On the server I use:
Y use a own queue (TCHAN) to comunicate between network reader an consumer thread, and childLocks to wait at the end with something like
waitForChildren childrenconstruct that I found on stackoverflow.UPDATE: the
waitForChildrenis on post Comparing Haskell threads to kernel threads – is my benchmark viable?