Indeed thatâs what I meant .
The context
A friend of mine asked me to be able to control my SC software live using her sequencer, Orca. I noticed it was able to send OSC messages, so I wrote a wrapper using OSCFunc :
var doSmthFunc = OSCFunc(
{ |msg, time, addr, recvPort|
~mySoftware.doSmth(); },
"/doSmth");
I was amazed by the simplicity of this. In short, this means that any âcomputerâ musician in my band can take control or interact with my own âcomputer instrumentâ. And thatâs not restricted to server commands, that can be any subtly-overcomplicated musical function I wrote.
Sidenotes :
- this also work with MIDI, see MIDIFunc.
- This comes with network delay.
So SCLang provides an elegant way to convert any piece of code into a remote controlled algorithm. So I naively though âOk, SCLang has the hard part implemented, all I have to do is to find both my local network IP and the port associated to SCLang, and give it to my friendâ. So I started looking up the documentation, but couldnât find any method to fetch the IP. Thatâs how I ended on this forum thread.
Is this relevant ?
Such method isnât implemented for the reasons mentioned above. IP manipulation is OS dependant.
But how it sounds in my brain is : âI, SCLang, have everything you need to provide remote control, except the ability to provide the correct adress.â. Sounds a bit weird (also, again, itâs legit).
Iâve seen a lot of people struggling setting up multi-client when using the server, because they didnât really know whatâs that âpublic IPâ thing they were asked for. But they all eventually succeeded, and they werenât using SCLang, but âsimplerâ languages like Sonic-Pi or FoxDot/Troop. Those people were artists rather than software engineers (pictural simplification ofc), and I think that most of SCLang users donât have any problem with OS manipulation, shell commands, etc.
Adding a method to provide IP inside SCLang doesnât adress this issue for languages who only communicate with the server.
Is this relevant : Iâd say yes, but I donât feel I have the ability to tell. This is mostly âquality of lifeâ as far as I can tell.
Is it secure?
I have no idea what is secure and what is not.
But I can see that such a method would kinda transform SCLang into a big red button with a mark on top of it : âI can give you my IP, an open port and a way to send me commands, and Iâm likely to be operating in real-time.â.
Best thing I can say about this.
How to implement
Only if itâs actually relevant.
I think the method goes into the Platform class, because itâs a method related to an OS operation.
The method can only get the IPs of the machine SCLang is running on, if a NetAddr is created to communicate with an other machine, it must already contain the other machine IP, right ?
I see two uses for this :
- get the IP to send OSC Msgs to SCLang (as in my previous example)
- get the IP of the âserverâ if it is local, to send it OSC Msgs directly (aka remote control)
So I think the main method should be inside Platform, and there would be an other method inside the Server class, which calls the one inside of Platform, because they essentially do the same thing ?
Then the method itself would be the one we already discussed previously, with proper documentation saying that since itâs OS dependant, it might fail because the proper underlying call might not be implemented for this specific OS ?