on master help sign in
expose the "connect" operation
343aa5dHarendra Kumar
src/Streamly/Internal/Network/Inet/TCP.hs+4−4
@@ -216,7 +216,7 @@ connectionsOnLocalHost = connectionsOnAddr (127,0,0,1)
216
216
217-- | Connect to the specified IP address and port number.
217-- | Connect to the specified IP address and port number.
218--
218--
219−-- /Internal/
219+-- @since 0.7.0
220connect :: (Word8, Word8, Word8, Word8) -> PortNumber -> IO Socket
220connect :: (Word8, Word8, Word8, Word8) -> PortNumber -> IO Socket
221connect addr port = do
221connect addr port = do
222 sock <- socket AF_INET Stream defaultProtocol
222 sock <- socket AF_INET Stream defaultProtocol
@@ -229,7 +229,7 @@ connect addr port = do
229-- closing the socket raises an exception, then this exception will be raised
229-- closing the socket raises an exception, then this exception will be raised
230-- by 'withServerAddrM'.
230-- by 'withServerAddrM'.
231--
231--
232−-- @since 0.7.0
232+-- /Internal/
233{-# INLINABLE withServerAddrM #-}
233{-# INLINABLE withServerAddrM #-}
234withServerAddrM :: (MonadMask m, MonadIO m)
234withServerAddrM :: (MonadMask m, MonadIO m)
235 => (Word8, Word8, Word8, Word8) -> PortNumber -> (Socket -> m ()) -> m ()
235 => (Word8, Word8, Word8, Word8) -> PortNumber -> (Socket -> m ()) -> m ()
@@ -246,7 +246,7 @@ withServerAddrM addr port =
246-- termination or in case of an exception. If closing the socket raises an
246-- termination or in case of an exception. If closing the socket raises an
247-- exception, then this exception will be raised by 'withServerAddr'.
247-- exception, then this exception will be raised by 'withServerAddr'.
248--
248--
249−-- @since 0.7.0
249+-- /Internal/
250{-# INLINABLE withServerAddr #-}
250{-# INLINABLE withServerAddr #-}
251withServerAddr :: (MonadCatch m, MonadIO m)
251withServerAddr :: (MonadCatch m, MonadIO m)
252 => Unfold m Socket a
252 => Unfold m Socket a
@@ -266,7 +266,7 @@ withServerAddr =
266-- handle raises an exception, then this exception will be raised by
266-- handle raises an exception, then this exception will be raised by
267-- 'withConnection' rather than any exception raised by 'act'.
267-- 'withConnection' rather than any exception raised by 'act'.
268--
268--
269−-- @since 0.7.0
269+-- /Internal/
270{-# INLINABLE withConnection #-}
270{-# INLINABLE withConnection #-}
271withConnection :: (IsStream t, MonadCatch m, MonadIO m)
271withConnection :: (IsStream t, MonadCatch m, MonadIO m)
272 => (Word8, Word8, Word8, Word8) -> PortNumber -> (Socket -> t m a) -> t m a
272 => (Word8, Word8, Word8, Word8) -> PortNumber -> (Socket -> t m a) -> t m a
src/Streamly/Network/Inet/TCP.hs+3
@@ -19,6 +19,9 @@ module Streamly.Network.Inet.TCP
19 , acceptOnPort
19 , acceptOnPort
20 , acceptOnPortLocal
20 , acceptOnPortLocal
21
21
22+ -- * Connect to Servers
23+ , connect
24+
22 {-
25 {-
23 -- ** Sink Servers
26 -- ** Sink Servers
24
27
src/Streamly/Network/Socket.hs+2−2
@@ -37,7 +37,7 @@ module Streamly.Network.Socket
37 -- * Accept Connections
37 -- * Accept Connections
38 , accept
38 , accept
39
39
40− -- * Read from connection
40+ -- * Read
41 , read
41 , read
42 -- , readUtf8
42 -- , readUtf8
43 -- , readLines
43 -- , readLines
@@ -52,7 +52,7 @@ module Streamly.Network.Socket
52 , readArraysOf
52 , readArraysOf
53 -- , readArrays
53 -- , readArrays
54
54
55− -- * Write to connection
55+ -- * Write
56 , write
56 , write
57 -- , writeUtf8
57 -- , writeUtf8
58 -- , writeUtf8ByLines
58 -- , writeUtf8ByLines