Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Convert numeric IP to Network.Socket.HostAddress (harry)
2. Re: Convert numeric IP to Network.Socket.HostAddress (Tim Perry)
3. Re: Convert numeric IP to Network.Socket.HostAddress
(Michael Snoyman)
----------------------------------------------------------------------
Message: 1
Date: Sun, 2 Feb 2014 21:01:24 +0000 (UTC)
From: harry <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Convert numeric IP to
Network.Socket.HostAddress
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
I need to convert a numeric IP (such as 1.2.3.4) to a HostAddress for
consumption by SockAddrInet. The only function I can find to do this is
inet_addr, which is impure (can do DNS lookups). Is there a pure conversion?
------------------------------
Message: 2
Date: Sun, 2 Feb 2014 13:30:45 -0800
From: Tim Perry <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Convert numeric IP to
Network.Socket.HostAddress
Message-ID:
<CAFVgASUujk1yr18x92bi=AA=owio8vqwxncpybc_vx+hm79...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Can you use the SockAddrUnix constructor of SockAddr?
See
http://hackage.haskell.org/package/network-2.2.1.3/docs/Network-Socket.html#t%3ASockAddr
Tim Perry
(916) 505-3634
On Sun, Feb 2, 2014 at 1:01 PM, harry <[email protected]> wrote:
> I need to convert a numeric IP (such as 1.2.3.4) to a HostAddress for
> consumption by SockAddrInet. The only function I can find to do this is
> inet_addr, which is impure (can do DNS lookups). Is there a pure
> conversion?
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140202/f7ff241e/attachment-0001.html>
------------------------------
Message: 3
Date: Mon, 3 Feb 2014 07:23:29 +0200
From: Michael Snoyman <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Convert numeric IP to
Network.Socket.HostAddress
Message-ID:
<caka2jglvjumyawdj3vdczuxvwb4qs_izcn2tz_o+x7p0dlc...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
You can use the functionality in Data.IP[1] (from iproutes) to accomplish
this. You'd first use `read` (or a safer version thereof, like
Safe.readMay) to convert a String to an IPv4, and then toHostAddress to
convert that to a HostAddress.
[1] http://hackage.haskell.org/package/iproute-1.2.11/docs/Data-IP.html
On Sun, Feb 2, 2014 at 11:01 PM, harry <[email protected]> wrote:
> I need to convert a numeric IP (such as 1.2.3.4) to a HostAddress for
> consumption by SockAddrInet. The only function I can find to do this is
> inet_addr, which is impure (can do DNS lookups). Is there a pure
> conversion?
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140203/e2a6fb42/attachment-0001.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 68, Issue 1
****************************************