ANN: network-alt 0.3 and hsgnutls 0.2.1
Einar Karttunen
ekarttun at cs.helsinki.fi
Mon Nov 7 05:01:25 EST 2005
On 07.11 08:16, Tomasz Zielonka wrote:
> > > Does it make sense to have the address type in there?
> > > Most of the time high level applications should not
> > > care whether the socket is IPv4 or IPv6 (or something
> > > entirely else).
>
> Sometimes applications exchange host addresses between
> themselves, consider a distributed system like DNS or
> a peer-to-peer network.
Which is entirely possible. Just use getHost and getService -
they should produce values which can be fed back to getAddrInfo.
Here is a scetch of a higher level API, does this implement
what you were after - and how to make this better?
newtype IPv4Address = IPv4 Word32
newtype IPv6Address = IPv6 Word128
newtype UnixAddress = Unix String -- Find a better name
newtype AnyAddress = AnyAddr (SocketType,SocketAddress)
class Resolver addrt where
resolve :: String -> Flags -> IO [addrt]
resolveReverse :: addrt -> Flags -> IO [String]
instance Resolver IPv4Address where ...
-- And the same for the rest
type Service = String -- or would Word16 be better?
class Connect addr where
connectStream :: addrt -> Service -> IO Socket
connectDgram :: addrt -> Service -> IO Socket
sendDGramString :: addrt -> Service -> String -> IO ()
- Einar Karttunen
More information about the Libraries
mailing list