[Haskell-cafe] UDP client/server
newhoggy at gmail.com
Thu Jan 11 19:54:54 EST 2007
What's wrong with my UDP client?
echoClient :: IO ()
echoClient = withSocketsDo $ do
sock <- socket AF_INET Datagram 0
connect sock (SockAddrInet 9900 iNADDR_ANY)
n <- send sock "hi"
*** Exception: connect: failed (Cannot assign requested address
On 1/12/07, Gregory Wright <gwright at comcast.net> wrote:
> Hi John,
> On Jan 11, 2007, at 10:35 AM, Gregory Wright wrote:
> > Hi John,
> > On Jan 11, 2007, at 1:58 AM, John Ky wrote:
> >> Hello,
> >> Does anyone know where I can find a simple UDP client/server
> >> written in Haskell?
> >> Something along the lines of an echo server would do.
> >> Thanks
> >> -John
> > Try:
> For testing, you need only use
> gregory-wrights-powerbook-g4-17> nc -ul -p 9900 127.0.0.1
> and whatever you type should be echoed. My original description
> of how to test:
> > On my OS X/ppc 10.4.8 system, the above builds with ghc 6.6 and if
> > I open one
> > terminal with
> > gregory-wrights-powerbook-g4-17> nc -u 127.0.0.1 9900
> > and another with
> > gregory-wrights-powerbook-g4-17> nc -ul -p 9900 127.0.0.1
> > whatever I type into the first terminal appears on the second. You
> > may have to
> > consult your documentation for the options to your version of nc
> > (or netcat,
> > if you use that instead).
> is wrong. (It will copy from one terminal to the other when the
> daemon is not present.)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe