hosc-0.17: Haskell Open Sound Control

Safe Haskell | None
Language | Haskell98

Sound.OSC.Transport.FD.TCP

Description

OSC over TCP implementation.

Synopsis

- data TCP = TCP {
  - tcpHandle :: Handle
  }
- 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 ()
- repeatM_ :: Monad m => m a -> m ()
- tcp_server :: Int -> (TCP -> IO ()) -> IO ()

# Documentation

data 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_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
    import Sound.OSC.Time
    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.

repeatM_ :: Monad m => m a -> m () Source #

`sequence_` of `repeat`.

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

A trivial `TCP` OSC server.