on 52b11eb help sign in
57 lines 1.8 kB history raw
1-- |
2-- Module : Streamly.Network.Socket
3-- Copyright : (c) 2018 Composewell Technologies
4--
5-- License : BSD3
6-- Maintainer : streamly@composewell.com
7-- Stability : experimental
8-- Portability : GHC
9--
10-- A socket is a handle to a protocol endpoint.
11--
12-- This module provides APIs to read and write streams and arrays from and to
13-- network sockets. Sockets may be connected or unconnected. Connected sockets
14-- can only send or recv data to/from the connected endpoint, therefore, APIs
15-- for connected sockets do not need to explicitly specify the remote endpoint.
16-- APIs for unconnected sockets need to explicitly specify the remote endpoint.
17--
18-- = Programmer Notes
19--
20-- Read IO requests to connected stream sockets are performed in chunks of
21-- 'Streamly.Internal.Memory.Array.Types.defaultChunkSize'. Unless specified
22-- otherwise in the API, writes are collected into chunks of
23-- 'Streamly.Internal.Memory.Array.Types.defaultChunkSize' before they are
24-- written to the socket. APIs are provided to control the chunking behavior.
25--
26-- > import qualified Streamly.Network.Socket as SK
27--
28-- For additional, experimental APIs take a look at
29-- "Streamly.Internal.Network.Socket" module.
31-- By design, connected socket IO APIs are similar to
32-- "Streamly.Memory.Array" read write APIs. They are almost identical to the
33-- sequential streaming APIs in "Streamly.Internal.FileSystem.File".
34--
35module Streamly.Network.Socket
36 (
37 -- * Socket Specification
38 SockSpec(..)
40 -- * Accept Connections
41 , accept
43 -- * Read
44 , read
45 , readWithBufferOf
46 , readChunks
47 , readChunksWithBufferOf
49 -- * Write
50 , write
51 , writeWithBufferOf
52 , writeChunks
53 )
54where
56import Streamly.Internal.Network.Socket
57import Prelude hiding (read)