I've just had a couple of troubles with Socket and SocketPrim. Let's take
the following program:

---------------------------------------------------------------
module Main where

import Socket hiding (recvFrom)
import SocketPrim

createSocket :: IO Socket
createSocket = do
         sock <- socket AF_INET Datagram 0
         let addr = (SockAddrInet (mkPortNumber 2000) iNADDR_ANY) in do
              bindSocket sock addr
              return sock

proc1 = connectTo "localhost" (PortNumber $ mkPortNumber 0) >>= 
        hGetContents >>= 
        print
        
proc2 = do
        sock <- createSocket
        recvFrom sock 1000

main = proc1 >> proc2
---------------------------------------------------------------
IMO proc1 should throw some exception or report error. Yet it just outputs
"".
proc2 should hang on a socket until someone connects to it. Nevertheless,
the program outputs:

Fail: resource exhausted
Action: recvFrom
Reason: insufficient resources

Maybe I'm doing sth wrong here?

Khaliff TM                                   [EMAIL PROTECTED]
                                             http://www2.ids.pl/~khaliff

"The bridge is crossed, so stand and watch it burn."



Reply via email to