aberant / osc-ruby

Open Sound Control Library for Ruby
MIT License
94 stars 16 forks source link

binding EMServer to localhost does not work when using devices that are not on the same ip #1

Closed withakay closed 13 years ago

withakay commented 14 years ago

def run EM::run { EM::open_datagram_socket "localhost", @port, Connection } end

the above code caused me problems when trying to get TouchOSC on an iPad to comunicate with my Mac (Snow Leopard 10.6.3, ruby 1.8.7). A local client/server would work but nothing from the iPad was being received. iPad to other osc compatible apps does work.

changing the EMServer class to accept an address parameter (below) and then passing in my local ip (i.e. 192.168.1.100) got it all working but is not really ideal when using DHCP.

class EMServer

def initialize( address = "localhost", port = 3333 )
  @port = port
  @address = address
  setup_dispatcher
  @tuples = []
end

def run
  EM::run { EM::open_datagram_socket @address,  @port, Connection }
end

Thanks

aberant commented 14 years ago

thanks for pointing this out. I've now changed the em_server to open a socket on 0.0.0.0. this means it will listen on any network interface you have. i've tested it with TouchOSC on my ipad and it works fine now.

i've pushed the 0.7.0 gem out to rubygems, so an update should pull down the new code.

let me know if you still have issues.

aberant commented 13 years ago

closing..