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?

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

Reply via email to