socket-0.8.0.0: An extensible socket library.

Copyright(c) Lars Petersen 2015
LicenseMIT
Maintainerinfo@lars-petersen.net
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

System.Socket.Family.Inet

Contents

Description

 

Synopsis

Inet

InetAddress

data InetAddress Source #

To avoid errors with endianess it was decided to keep this type abstract.

Use inetAddressFromTuple and inetAddressToTuple for constructing and deconstructing custom addresses.

Hint: Use the Storable instance. It exposes it exactly as found within an IP packet (big endian if you insist on interpreting it as a number).

Another hint: Use getAddressInfo for parsing and suppress nameserver lookups:

> getAddressInfo (Just "127.0.0.1") Nothing aiNumericHost :: IO [AddressInfo Inet Stream TCP]
[AddressInfo {addressInfoFlags = AddressInfoFlags 4, socketAddress = SocketAddressInet {inetAddress = InetAddress 127.0.0.1, inetPort = InetPort 0}, canonicalName = Nothing}]

InetPort

SocketAddress Inet

Custom addresses

inetAddressFromTuple

inetAddressFromTuple :: (Word8, Word8, Word8, Word8) -> InetAddress Source #

Constructs a custom InetAddress.

inetAddressFromTuple (127,0,0,1) == inetLoopback

inetAddressToTuple

Special addresses

inetAllHostsGroup

inetAny

inetBroadcast

inetBroadcast :: InetAddress Source #

255.255.255.255

inetLoopback

inetMaxLocalGroup

inetNone

inetNone :: InetAddress Source #

255.255.255.255

inetUnspecificGroup