
25 Jan
2009
25 Jan
'09
11:22 a.m.
I'm trying to write a simple program that involves UDP. I was hoping something like this would work: module Main where import Network.Socket main = withSocketsDo main2 main2 = do s <- socket AF_INET Datagram defaultProtocol putStrLn "Waiting..." x <- recv s 100 putStrLn x Unfortunately, that doesn't work at all. It immediately throws an exception ("unknown error"). But then, the whole module seems to be completely undocumented. I managed to find a tiny amount of info online about the underlying C API, but I still don't get how the Haskell interface is supposed to be used. Any hints?