
hello, i want to write/read data to the soccerserver of the robocup. the sample code below works, but i want to have a handle for writing to the server instead of SocketPrim.sendTo. how can i do that ? import IO import Socket import SocketPrim local = "127.0.0.1" portnum = 6000 local' = iNADDR_ANY portnum' = aNY_PORT main = withSocketsDo $ do -- create udp socket s1 <- socket AF_INET Datagram 0 ia <- inet_addr local -- bind socket to first free port given by system bindSocket s1 (SockAddrInet ( portnum') local') -- write to soccerserver on port 6000 SocketPrim.sendTo s1 "(init myteam)" (SockAddrInet ( portnum) ia) h' <- socketToHandle s1 ReadWriteMode hSetBuffering h' LineBuffering -- hPutsStr not works: Reason: Transport endpoint is not connected ?! -- hPutStr h' "foo" -- bad style infinity loop, just for testing testloop h' testloop h = do b <- hWaitForInput h 2000 if b == True then do line <- hGetChar h hFlush h putChar line else putStrLn "End of Input" testloop h Greetings, Thomas Rabe. -- mail: raven at drehmoment dot org -- home: http://hal9000.drehmoment.org -- more: http://drehmoment.org