"Error opening socket on specified port."

disuye's picture

This is not technically a Kineme related problem but I'm a bit stuck where to post for help.

Learning how to use QC View / QC Patch Controller in Interface Builder / Xcode ... ran some tests and managed to get a dummy Quartz Composition to publish it's Inputs to I could then bind GUI controls... All good there.

Current sticking point: Am trying to load a composition which contains Hexler's qcOSC Plug-in into either the QC Patch Controller or QC View and I keep getting the same error message "Error opening socket on specified port. Please choose a different port." and I get the same error again when trying to run a simulation.

Removing the qcOSC patch from the composition allows it to embed & the simulation to be run.

Just for the record, I tried to open the composition in QuickTime and got word for word the same error message. Is this error related to the so-called 'safe mode' I read about on this site (re: your SafeMIDI thing)? Or am I barking up the wrong tree.

Is there anyway to get OSC in & out of a composition embedded into a Cocoa application?

Many thanks for reading,

Dan

dust's picture
Re: "Error opening socket on specified port."

I would use the apple osc patches. For what ever reasons hexlers osc patch is very in stable. The ability to have your namespace automatically filled in for you is wonderful but that doesn't make up for how it will crash your compositions almost every time if not before you can even save and if not the first open of a composition most definatly crashes the second time you open it from the first time it crashed. Not sure if here is some port binding issues or overflow issues ? Using osc in the context of your own application is certainly possible. The up side to using apples patch is that it is not a plugin therefore it is more of a portable solution in respects to your application not needing the dependencies of an external plugin. The kineme safe osc is for getting your osc to work in a host enviornment. Unless you explicitly tell your application to run in safe mode then osc will work from an intrface builder or quartz builder apication

disuye's picture
Re: "Error opening socket on specified port."

Many thanks for the reply.

The problem I was having with the standard Apple OSC Receiver patch (at least on OSX10.5) is that is has a bug which causes it to receive (or generate?) null data in between each received message ...i:e: stuttering to zero. This bug was one of the reasons that Hexler created the qcOSC plugin (and why I downloaded it).

I read on the Apple Dev site that 10.6 QC fixes this issue, but even if I bothered to upgrade my machine at the studio (which I'm not in a rush to), the iMac in the bar is PPC and won't run Snow Leopard. It's running 10.5 no prb.

Bollocks. It looks like I'm out of luck unless someone else has any sugestions. I could Osculator as an OSC to MIDI intermediate stage between TouchOSC and my application, but the whole point of programming my own app was to keep the process simple for my staff at the venue.

dust's picture
Re: "Error opening socket on specified port."

try kineme "safe osc" or manserati's osc plugins have some cool features. click on 3rd party plugins on the kineme home page for manserati's. im not sure where the kineme safe osc is anymore you'll have to search the site. i highly suggest maybe building a plugin that suites your needs with the BBOSC library. thats the library i use. haven't run into any binding issues with BBOSC. i think his solution is to combine a listener on the port your sending to even if your just sending. or at least thats how i got rid of port binding issues. there is also vvosc that mansarti uses not sure about that framework but he has the ip exposed as an input so you can scan for open ports.

disuye's picture
Re: "Error opening socket on specified port."

Funny you just mentioned the above ... I was thinking about trying to find an OSC framework to listen for incoming message and somehow feed the data through to QC; and after surfing around for a while I stumbled across both the BBOSC and the VVOSC links. Finding the VV one explained on CreateDigitalMusic.com prompted me to check that out first:

http://code.google.com/p/vvopensource/

This is all incredibly new ground for me (I'm not a programmer but recently decided to make the effort to learn), so no doubt I'll be banging my head on the desk all weekend and back here Monday with more dumb questions.

Thanks for the info / replies though, much appreciated.

cwright's picture
Re: "Error opening socket on specified port."

just a short heads up -- the problem you're running into isn't safe-mode related at all -- that has a very different error message.

the message looks like it's trying to open the same port multiple times -- this, of course, is impossible (you can't have 2 servers listening on the same port at the same time). I don't know much about the plugin you're using, but you could try chancing the port numbers to see if that fixes it, or making sure you're only running one instance of it at a time (i.e. only running it in QC, or your app, but not both at the same time).

disuye's picture
Re: "Error opening socket on specified port."

cwright wrote:
just a short heads up -- the problem you're running into isn't safe-mode related at all -- that has a very different error message.

A good night's sleep on this and you're right... qcOSC works fine, and without hitch because of the following scenario:

Turns out that launching a Simulation while Interface Builder was running, was the problem. I didn't realise that Interface Builder would be running the composition (and hence grabbing the OSC ports eventually required by the simulation), so that when the simulation was launched, the ports were already taken; ergo the error message.

The trick (albeit a clunky workflow) is to load the QC comps into Interface Builder then save & quit... go back to Xcode and press the 'Build & Go' button: My Application launches in the foreground, only one OSC port is addressed, no errors and we're good to go.

Thanks guys for your help, it was all appreciated.

disuye's picture
Re: "Error opening socket on specified port."

Incidentally - I downloaded vvOSC and had a poke around – so if someone could point me towards a detailed idiot's level tutorial showing how to get the framework into Xcode and then bind / make the ports available to any given Quartz COmposer comp's Inputs / Outputs... that would be very much appreciated.

dust's picture
Re: "Error opening socket on specified port."

well im familiar with BBOSC but there is a custom patch guide on apple site that is pretty basic.

you should download manseratis OSC plug in source code and have a look a vvosc. or how he uses it. you will have to build the framework then add to his source or your own in order to use normally.

seeing i do things for the iphone more in cocoa and you can't build external frameworks with the exception of open frameworks. i just load up all the class files into my project or build a dynamic library instead of framework.

but making the plugins from the apple docs is pretty strait forward. they have an example of provider, processors etc that are fairly strait forward, the actual imaging or consumer patches take a lot more work and require some requisite knowledge of open GL.

making an OSC plugin should be fairly easy after you have done a few tutorials. basically you would be using what ever example code comes with the framework and just plop your plugin variables where they need to go.

like self.ip = some example code.

so qcOSC doesn't crash your machine ever ? it does mine.

disuye's picture
Re: "Error opening socket on specified port."

qcOSC has been 100% stable here so far!

(Intel laptop / G5 desktop; both running 10.5.6 and up)

Although to be fair I am not doing anything heavy with it ... just perhaps 20-30 control inputs from TouchOSC.

Will take your advice above and see what I can find. Cheers!

dust's picture
Re: "Error opening socket on specified port."

20-30 is a lot to me it seems. i like to put things in arrays or structures its easier to sort of bundle your arguments at least to manage for an OSC server or client. although i do have itouch osc and sonic life, well to be frank have every osc midi controller on the market for my i pod. i even built a few of my own. i have been using msa remote lately because it sends TUIO and OSC. i recommend OSCulator it makes alot of things easier but honestly you can do all the same things with quartz composer and kineme.