Hi,<br><br>What&#39;s wrong with my UDP client?<br><br>echoClient :: IO ()<br>echoClient = withSocketsDo $ do<br>&nbsp;&nbsp;&nbsp; putStrLn &quot;[a]&quot;<br>&nbsp;&nbsp;&nbsp; sock &lt;- socket AF_INET Datagram 0<br>&nbsp;&nbsp;&nbsp; putStrLn &quot;[b]&quot;<br>&nbsp;&nbsp;&nbsp; connect sock (SockAddrInet 9900 iNADDR_ANY)
<br>&nbsp;&nbsp;&nbsp; putStrLn &quot;[c]&quot;<br>&nbsp;&nbsp;&nbsp; n &lt;- send sock &quot;hi&quot;<br>&nbsp;&nbsp;&nbsp; putStrLn &quot;[d]&quot;<br>&nbsp;&nbsp;&nbsp; return ()<br><br>I get:<br><br>*Main&gt; 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> &lt;<a href="mailto:gwright@comcast.net">gwright@comcast.net</a>&gt; 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>&gt;<br>&gt; Hi John,<br>&gt;<br>&gt; On Jan 11, 2007, at 1:58 AM, John Ky wrote:<br>&gt;<br>&gt;&gt; Hello,<br>&gt;&gt;<br>&gt;&gt; Does anyone know where I can find a simple UDP client/server
<br>&gt;&gt; written in Haskell?<br>&gt;&gt;<br>&gt;&gt; Something along the lines of an echo server would do.<br>&gt;&gt;<br>&gt;&gt; Thanks<br>&gt;&gt;<br>&gt;&gt; -John<br>&gt;&gt;<br>&gt;<br>&gt; Try:<br>&gt;<br>&gt;<br>
<br>&lt;snip&gt;<br><br>For testing, you need only use<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gregory-wrights-powerbook-g4-17&gt; 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.&nbsp;&nbsp;My original description
<br>of how to test:<br>&gt;<br>&gt; On my OS X/ppc 10.4.8 system, the above builds with ghc 6.6 and if<br>&gt; I open one<br>&gt; terminal with<br>&gt;<br>&gt; gregory-wrights-powerbook-g4-17&gt; nc -u <a href="http://127.0.0.1">
127.0.0.1</a> 9900<br>&gt;<br>&gt; and another with<br>&gt;<br>&gt; gregory-wrights-powerbook-g4-17&gt; nc -ul -p 9900 <a href="http://127.0.0.1">127.0.0.1</a><br>&gt;<br>&gt; whatever I type into the first terminal appears on the second.&nbsp;&nbsp;You
<br>&gt; may have to<br>&gt; consult your documentation for the options to your version of nc<br>&gt; (or netcat,<br>&gt; if you use that instead).<br><br>is wrong.&nbsp;&nbsp;(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>