Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharing a socket for client and server #16

Open
digitalshow opened this issue Jun 4, 2020 · 3 comments
Open

Sharing a socket for client and server #16

digitalshow opened this issue Jun 4, 2020 · 3 comments

Comments

@digitalshow
Copy link

I have the following application scheme:
There is a OSC UDP server that has some properties. I connect to it and can subscribe to property changes by sending to "/xremote" periodically. The server will then send me updates on properties to the port I sent the subscription message from. So I need to receive from the same socket as I use for sending.

I use the following workaround:

@client = OSC::Client.new('10.1.2.3', 1234)
@server = OSC::EMServer.new(99999)
socket =  @client.instance_variable_get(:@so)

def @server.run(s)
  EM.error_handler{ |e|
    Thread.main.raise e
  }

  EM.run do
    EM::attach s, OSC::Connection
  end
end

It would be nice to have the possibility without a hack.

@aberant
Copy link
Owner

aberant commented Jun 4, 2020

I see what you mean. I'll work through some ideas and let you know.

@aberant
Copy link
Owner

aberant commented Jun 16, 2020

I'm thinking I'll go with something like your example.

@client = OSC::Client.new('10.1.2.3', 1234)
@server = OSC::EMServer.from_socket(@client.socket)
@server.run

I just need to think up a way to support the new factory methods I want that also doesn't mess up the simple EMServer initializer signature.

@aberant
Copy link
Owner

aberant commented Dec 6, 2020

I'm still slowly working on this when I get free time. I'm coming up with a test harness for this and having to learn super collider so I can confidently say if my changes work or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants