hosc-0.20: Haskell Open Sound Control

Safe Haskell | Safe-Inferred
Language | Haskell2010

Sound.Osc.Transport.Fd.Tcp

Description

Osc over Tcp implementation.

Synopsis

- newtype Tcp = Tcp {
  - tcpHandle :: Handle
  }
- tcp_send_data :: Tcp -> ByteString -> IO ()
- tcp_send_packet :: Tcp -> Packet -> IO ()
- tcp_recv_packet :: Tcp -> IO Packet
- tcp_close :: Tcp -> IO ()
- with_tcp :: IO Tcp -> (Tcp -> IO t) -> IO t
- tcp_socket :: (Socket -> SockAddr -> IO ()) -> Maybe String -> Int -> IO Socket
- socket_to_tcp :: Socket -> IO Tcp
- tcp_handle :: (Socket -> SockAddr -> IO ()) -> String -> Int -> IO Tcp
- openTcp :: String -> Int -> IO Tcp
- tcp_server_f :: Socket -> (Tcp -> IO ()) -> IO ()
- tcp_server :: Int -> (Tcp -> IO ()) -> IO ()

# Documentation

newtype Tcp Source #

The Tcp transport handle data type.

Constructors

Tcp |

Fields

- tcpHandle :: Handle

#### Instances

Instances details

Transport Tcp Source # | `Tcp` is an instance of `Transport`.
Instance details Defined in Sound.Osc.Transport.Fd.Tcp Methods sendPacket :: Tcp -> Packet -> IO () Source # recvPacket :: Tcp -> IO Packet Source # close :: Tcp -> IO () Source #

tcp_send_data :: Tcp -> ByteString -> IO () Source #

Send data over Tcp.

tcp_send_packet :: Tcp -> Packet -> IO () Source #

Send packet over Tcp.

tcp_recv_packet :: Tcp -> IO Packet Source #

Receive packet over Tcp.

tcp_close :: Tcp -> IO () Source #

Close Tcp.

with_tcp :: IO Tcp -> (Tcp -> IO t) -> IO t Source #

Bracket UDP communication.

tcp_socket :: (Socket -> SockAddr -> IO ()) -> Maybe String -> Int -> IO Socket Source #

Create and initialise Tcp socket.

socket_to_tcp :: Socket -> IO Tcp Source #

Convert `Socket` to `Tcp`.

tcp_handle :: (Socket -> SockAddr -> IO ()) -> String -> Int -> IO Tcp Source #

Create and initialise Tcp.

openTcp :: String -> Int -> IO Tcp Source #

Make a `Tcp` connection.

    import Sound.Osc.Datum {- hosc -}
    import Sound.Osc.Time {- hosc -}
    let t = openTcp "127.0.0.1" 57110
    let m1 = Packet.message "/dumpOsc" [Int32 1]
    let m2 = Packet.message "/g_new" [Int32 1]
    Fd.withTransport t (\fd -> let f = Fd.sendMessage fd in f m1 >> pauseThread 0.25 >> f m2)

tcp_server_f :: Socket -> (Tcp -> IO ()) -> IO () Source #

`accept` connection at s and run f.

tcp_server :: Int -> (Tcp -> IO ()) -> IO () Source #

A trivial `Tcp` Osc server.