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

Random server port #3

Open
daveyijzermans opened this issue Apr 27, 2019 · 7 comments
Open

Random server port #3

daveyijzermans opened this issue Apr 27, 2019 · 7 comments

Comments

@daveyijzermans
Copy link

Hi! Thanks for your work in sniffing the Focusrite server protocol! I've used it to create my own implementation in Node.js. However, I try to connect with my client to a different computer on the network.

Until now this has worked, but suddenly the port to the control server has changed! It first was 49935, now on one computer it's 49930 and on another computer it's become 49943.

In your source code the port is hardcoded as 49152 (AppDelegate.swift, line 16) but this has never been the case for me.

I'm using the Focusrite Control Server on Windows though, might that be a cause of the issue? Do you have an idea how I can search for the right port each time or why even the port is changing?

Thanks!

@raduvarga
Copy link
Owner

Hi! Good question!
I experienced a similar issue, my case was that at some point I had another server installed which took port 49152, and noticed that FocusriteControlServer would start on 49153. This was the case only sometimes, depending on which of the two servers would start first. My guess would be that for Mac, the default port is 49152, then if not available they increment until they find something available.

I have 2 solutions in mind:

  1. Run a terminal command in the code which gets the port of "FocusriteControlServer"
  2. Incrementally try ports until you get a valid response. Considering the jumps you've described (49930-49943), this might be inefficient and take too long.

Right now I don't have time to code them into the Swift app, let me know if you have a working solution.

@daveyijzermans
Copy link
Author

Thank for your response! I thought about this approach as well, but thinking it would be rather slow. So I downloaded the iOS app, configured Wireshark to sniff my iPhone traffic. Turns out the iPhone sends a UDP broadcast message. Focusrite Control Servers on the network listen to this and is they receive a message they send back a response with the correct port!

See this gist for a Node.js implementation. I think you can rewrite this to C/Swift if you want to include it in your application. Sorry I don't know C(++)/Swift!

https://gist.github.com/daveyijzermans/f0354858b3eb765e19361ab85a6bc55b

Hope that helps. Sorry I answered my own question the day after. 😅

Kind regards,

Davey

@raduvarga
Copy link
Owner

Great find, thanks for sharing this gist!

@xnaron
Copy link

xnaron commented Aug 8, 2019

Thank for your response! I thought about this approach as well, but thinking it would be rather slow. So I downloaded the iOS app, configured Wireshark to sniff my iPhone traffic. Turns out the iPhone sends a UDP broadcast message. Focusrite Control Servers on the network listen to this and is they receive a message they send back a response with the correct port!

See this gist for a Node.js implementation. I think you can rewrite this to C/Swift if you want to include it in your application. Sorry I don't know C(++)/Swift!

https://gist.github.com/daveyijzermans/f0354858b3eb765e19361ab85a6bc55b

Hope that helps. Sorry I answered my own question the day after. 😅

Kind regards,

Davey

Hi Davey,
Any chance you can share your node.js code? I'd like to experiment with it as I am trying to interface to a hardware volume knob I built.
thanks,
Brendin

@daveyijzermans
Copy link
Author

When you run the gist it should spit out the server ip and port of any Focusrite Control Server running and you can create a standard UDP socket to it and interact with the server as figured out by this repo's creator. It's fun to try to decode it yourself. :)

If you're looking for an example, you can take a look at my project. Although it is part of something else I think you can extract the necessary bits from it.

@xnaron
Copy link

xnaron commented Aug 10, 2019

When you run the gist it should spit out the server ip and port of any Focusrite Control Server running and you can create a standard UDP socket to it and interact with the server as figured out by this repo's creator. It's fun to try to decode it yourself. :)

If you're looking for an example, you can take a look at my project. Although it is part of something else I think you can extract the necessary bits from it.

Thanks. I built the UDP discovery based off of your code for my ESP8266 Arduino project.

@raduvarga
Copy link
Owner

@daveyijzermans Massive thanks for figuring out the UDP trick, extremely helpful!
I've coded a completely new version that's much more stable, if you're curious you can check it here: https://www.raduvarga.com/software/focusrite-midi-control

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

3 participants