hosc-0.20: Haskell Open Sound Control
Safe HaskellSafe-Inferred
LanguageHaskell2010

Sound.Osc.Transport.Fd.Tcp

Description

Osc over Tcp implementation.

Synopsis

Documentation

newtype Tcp Source #

The Tcp transport handle data type.

Constructors

Tcp 

Fields

Instances

Instances details
Transport Tcp Source #

Tcp is an instance of Transport.

Instance details

Defined in Sound.Osc.Transport.Fd.Tcp

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.

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.

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

A trivial Tcp Osc server.