Hi,<br><br>What's wrong with my UDP client?<br><br>echoClient :: IO ()<br>echoClient = withSocketsDo $ do<br> putStrLn "[a]"<br> sock <- socket AF_INET Datagram 0<br> putStrLn "[b]"<br> connect sock (SockAddrInet 9900 iNADDR_ANY)
<br> putStrLn "[c]"<br> n <- send sock "hi"<br> putStrLn "[d]"<br> return ()<br><br>I get:<br><br>*Main> echoClient<br>[a]<br>[b]<br>*** Exception: connect: failed (Cannot assign requested address (WSAEADDRNOTAVAI
<br>L))<br><br>Thanks<br><br>-John<br><br><br><div><span class="gmail_quote">On 1/12/07, <b class="gmail_sendername">Gregory Wright</b> <<a href="mailto:gwright@comcast.net">gwright@comcast.net</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>Hi John,<br><br>On Jan 11, 2007, at 10:35 AM, Gregory Wright wrote:<br><br>><br>> Hi John,<br>><br>> On Jan 11, 2007, at 1:58 AM, John Ky wrote:<br>><br>>> Hello,<br>>><br>>> Does anyone know where I can find a simple UDP client/server
<br>>> written in Haskell?<br>>><br>>> Something along the lines of an echo server would do.<br>>><br>>> Thanks<br>>><br>>> -John<br>>><br>><br>> Try:<br>><br>><br>
<br><snip><br><br>For testing, you need only use<br><br> gregory-wrights-powerbook-g4-17> nc -ul -p 9900 <a href="http://127.0.0.1">127.0.0.1</a><br><br>and whatever you type should be echoed. My original description
<br>of how to test:<br>><br>> On my OS X/ppc 10.4.8 system, the above builds with ghc 6.6 and if<br>> I open one<br>> terminal with<br>><br>> gregory-wrights-powerbook-g4-17> nc -u <a href="http://127.0.0.1">
127.0.0.1</a> 9900<br>><br>> and another with<br>><br>> gregory-wrights-powerbook-g4-17> nc -ul -p 9900 <a href="http://127.0.0.1">127.0.0.1</a><br>><br>> whatever I type into the first terminal appears on the second. You
<br>> may have to<br>> consult your documentation for the options to your version of nc<br>> (or netcat,<br>> if you use that instead).<br><br>is wrong. (It will copy from one terminal to the other when the<br>
daemon is not present.)<br><br>Best,<br>Greg<br><br></blockquote></div><br>