network- Low-level networking interface

Safe HaskellNone




The Network.BSD module defines Haskell bindings to network programming functionality provided by BSD Unix derivatives.


Host names

type HostName = StringSource

Either a host name e.g., "" or a numeric host address string consisting of a dotted decimal IPv4 address or an IPv6 address e.g., "".

getHostName :: IO HostNameSource

Calling getHostName returns the standard host name for the current processor, as set at boot time.

data HostEntry Source


Read HostEntry 
Show HostEntry 
Typeable HostEntry 
Storable HostEntry 

getHostByName :: HostName -> IO HostEntrySource

Resolve a HostName to IPv4 address.

getHostByAddr :: Family -> HostAddress -> IO HostEntrySource

Get a HostEntry corresponding to the given address and family. Note that only IPv4 is currently supported.

Low level functionality

setHostEntry :: Bool -> IO ()Source

Service names

type ServiceName = StringSource

Low level functionality

setServiceEntry :: Bool -> IO ()Source

Protocol names

type ProtocolName = StringSource

defaultProtocol :: ProtocolNumberSource

This is the default protocol for a given service.

Low level functionality

setProtocolEntry :: Bool -> IO ()Source

Port numbers

data PortNumber Source


Enum PortNumber 
Eq PortNumber 
Integral PortNumber 
Num PortNumber 
Ord PortNumber 
Real PortNumber 
Show PortNumber 
Typeable PortNumber 
Storable PortNumber 

Network names

type NetworkName = StringSource

type NetworkAddr = CULongSource

getNetworkEntries :: Bool -> IO [NetworkEntry]Source

Get the list of network entries.

Low level functionality

setNetworkEntry :: Bool -> IO ()Source

Open the network name database. The parameter specifies whether a connection is maintained open between various networkEntry calls

endNetworkEntry :: IO ()Source

Close the connection to the network name database.