Air app gets a Socket Error trying to connect to webservice

Supporting 10.7 and up
ericsama
Fresh meat
Posts: 4
Joined: Mon Jul 16, 2012 3:37 pm
Contact:

Air app gets a Socket Error trying to connect to webservice

Postby ericsama » Mon Jul 16, 2012 4:14 pm

I have an Adobe Air app (AIR 3.2) that is throwing an error 'Error #2031: Socket Error. URL: localhost' when I attempt to connect to the Phidget web service on OSX. Here is the attempt to open: 'phidgetAdvancedServo.open("localhost", 5001)', which throws the error 'PhidgetErrorEvent.ERROR'. The web service was started via the Phidgets app under 'System preferences' and is using the default port 5001. The same app connects just fine to the web service when it runs on windows. I'm not real familiar with OSX, could there be a firewall blocking localhost or do I need to use a different name / ip?

ericsama
Fresh meat
Posts: 4
Joined: Mon Jul 16, 2012 3:37 pm
Contact:

Re: Air app gets a Socket Error trying to connect to webserv

Postby ericsama » Mon Jul 16, 2012 5:30 pm

I've discovered if I start the web service via the command line (using the 'NativeProcess' class in as3) it works. So I'm guessing the Phidgets GUI wasn't really starting the web service or something strange was happening there.

digitalmatt
Phidgetsian
Posts: 12
Joined: Wed Jul 25, 2012 1:24 pm
Contact:

Re: Air app gets a Socket Error trying to connect to webserv

Postby digitalmatt » Wed Jul 25, 2012 4:45 pm

ericsama wrote:I've discovered if I start the web service via the command line (using the 'NativeProcess' class in as3) it works. So I'm guessing the Phidgets GUI wasn't really starting the web service or something strange was happening there.


Having a similar issue. I'm simply running a flash movie from within Flash CS5 and getting the same error. I've started the webservice, I've added the swf to the list of trusted locations in global security settings. But still no dice. How might I start the webservice from the command line?

ericsama
Fresh meat
Posts: 4
Joined: Mon Jul 16, 2012 3:37 pm
Contact:

Re: Air app gets a Socket Error trying to connect to webserv

Postby ericsama » Wed Jul 25, 2012 5:36 pm

Use the Flash NativeProcess and NativeProcessStartupInfo classes. The file for windows is PhidgetWebservice21.exe, for Mac it's called 'phidgetwebservice21'.
Here's a piece of code I use for windows...

if(Capabilities.supports64BitProcesses)
file = new File(File.applicationDirectory.nativePath +"\\IncludedAirAppFiles\\Phidgets\\x64\\PhidgetWebservice21.exe");
else
file = new File(File.applicationDirectory.nativePath +"\\IncludedAirAppFiles\\Phidgets\\x86\\PhidgetWebservice21.exe");
if(!file.exists)
throw new Error("Phidgets .exe doesn't exist: "+ file.nativePath);
var processArgs:Vector.<String> = new Vector.<String>;
processArgs.push("-p");
processArgs.push(PHIDGETS_LOCAL_PORT);
processArgs.push("-v");
var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartupInfo.arguments = processArgs;
nativeProcessStartupInfo.executable = file;
outPrint("starting WINDOWS native process: "+ nativeProcessStartupInfo.executable.nativePath +" "+ processArgs[0] +" "+ processArgs[1] +" "+ processArgs[2]);
nativeProcess = new NativeProcess();
nativeProcess.start(nativeProcessStartupInfo);
nativeProcess.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, npOutputData);

ericsama
Fresh meat
Posts: 4
Joined: Mon Jul 16, 2012 3:37 pm
Contact:

Re: Air app gets a Socket Error trying to connect to webserv

Postby ericsama » Thu Aug 02, 2012 11:36 am

So now I’m testing on a new MacBook with OS X 10.7.4 and now the webservice (phidgetwebservice21) exits a few seconds after I start it via flash native process (see above on how I’m doing that). When I run the same command (‘/usr/bin/phidgetwebservice21’) in the OS X terminal, I get the error: 'Segmentation fault 11'. Anyone have any ideas? Not sure why the webservice starts and runs fine on the couple of OS X 10.6 boxes I tried it on, but dies after a second on 10.7.


Return to “macOS”

Who is online

Users browsing this forum: No registered users and 2 guests