network- Low-level networking interface

Copyright(c) The University of Glasgow 2001
LicenseBSD-style (see the file libraries/network/LICENSE)
Safe HaskellNone




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


Host names

type HostName = String Source

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 HostName Source

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

getHostByName :: HostName -> IO HostEntry Source

Resolve a HostName to IPv4 address.

getHostByAddr :: Family -> HostAddress -> IO HostEntry Source

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

Low level functionality

Service names

Low level functionality

Protocol names

defaultProtocol :: ProtocolNumber Source

This is the default protocol for a given service.

Low level functionality

Port numbers

data PortNumber Source

Use the Num instance (i.e. use a literal) to create a PortNumber value with the correct network-byte-ordering. You should not use the PortNum constructor. It will be removed in the next release.

Network names

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.

Interface names