Class: OSC::Server

Inherits:
Object show all
Defined in:
lib/osc-ruby/server.rb

Instance Method Summary collapse

Constructor Details

#initialize(port) ⇒ Server

Returns a new instance of Server.



4
5
6
7
8
9
# File 'lib/osc-ruby/server.rb', line 4

def initialize(port)
  @socket = UDPSocket.new
  @socket.bind('', port)
  @cb = []
  @queue = Queue.new
end

Instance Method Details

#add_method(address_pattern, &proc) ⇒ Object



21
22
23
24
25
# File 'lib/osc-ruby/server.rb', line 21

def add_method(address_pattern, &proc)
  matcher = AddressPattern.new( address_pattern )
  
  @cb << [matcher, proc]
end

#runObject



11
12
13
14
15
# File 'lib/osc-ruby/server.rb', line 11

def run
  start_dispatcher
  
  start_detector
end

#stopObject



17
18
19
# File 'lib/osc-ruby/server.rb', line 17

def stop
  @socket.close
end