|
Network.TCP | Portability | non-portable (not tested) | Stability | experimental | Maintainer | Sigbjorn Finne <sigbjorn.finne@gmail.com> |
|
|
|
Description |
Some utility functions for working with the Haskell network package. Mostly
for internal use by the Network.HTTP code, but
|
|
Synopsis |
|
|
|
Documentation |
|
data Connection |
The Connection newtype is a wrapper that allows us to make
connections an instance of the Stream class, without GHC extensions.
While this looks sort of like a generic reference to the transport
layer it is actually TCP specific, which can be seen in the
implementation of the 'Stream Connection' instance.
| Instances | |
|
|
openTCPPort :: String -> Int -> IO Connection |
openTCPPort uri port establishes a connection to a remote
host, using getHostByName which possibly queries the DNS system, hence
may trigger a network connection.
|
|
isConnectedTo :: Connection -> String -> IO Bool |
Checks both that the underlying Socket is connected
and that the connection peer matches the given
host name (which is recorded locally).
|
|
openTCPConnection :: BufferType ty => String -> Int -> IO (HandleStream ty) |
|
socketConnection :: BufferType ty => String -> Socket -> IO (HandleStream ty) |
socketConnection, like openConnection but using a pre-existing Socket.
|
|
isTCPConnectedTo :: HandleStream ty -> String -> IO Bool |
|
data HandleStream a |
|
class BufferType bufType => HStream bufType where |
HStream overloads the use of HandleStreams, letting you
overload the handle operations over the type that is communicated
across the handle. It is used in the context of Network.HTTP to
buy us freedom in how HTTP Request and Response payloads are
represented.
The package provides instances for ByteStrings and String, but
should you want to plug in your own payload representation, defining
your own HStream instance is all it takes.
| | Methods | | | Instances | |
|
|
data StreamHooks ty |
Constructors | | Instances | |
|
|
nullHooks :: StreamHooks ty |
|
setStreamHooks :: HandleStream ty -> StreamHooks ty -> IO () |
|
hstreamToConnection :: HandleStream String -> Connection |
|
Produced by Haddock version 2.5.0 |