IDE Communication Not Working

I am trying to communicate with the internal xojo IPC socket using Xojo 2015 r2.2 on OSX 10.10.5. I am using code provided in the examples/advanced/IDEScripting/IDECommunication/ from the IDECommunicator module. My issue is that I keep getting error 103: Name resolution error with the IDE IPC socket. Sometimes it connects and works, but then the connection goes away and I can not get it back. I try restarting Xojo, but it takes a complete reboot of the system to get the IDE socket back up and running. After the restart, I get the same behavior, a few moments of connection followed by nothing. IPC’s are basically two processes writing/reading to/from the same file, so my question is where is this file for the xojo IPC socket? I try following the path provided in the example projects, but there is nothing there. Also, does anyone know why I am able to connect to the socket, send a couple commands, but then have the connection seemingly die on me?

You don’t happen to have two IDEs running, do you?

I remember having reported a bug a while ago where I found that the connection to the IDE only work every other (2nd) time. So, once it works, then, after closing the connection, the next one fails, then again it works. Something like that.
Do you see that behavior, Erin?

(Well, I thought I had reported such a bug but can’t find it via Feedback.app. Meh)

[quote=214895:@Thomas Tempelmann]I remember having reported a bug a while ago where I found that the connection to the IDE only work every other (2nd) time. So, once it works, then, after closing the connection, the next one fails, then again it works. Something like that.
Do you see that behavior, Erin?

(Well, I thought I had reported such a bug but can’t find it via Feedback.app. Meh)[/quote]
You did, and it’s been fixed. I just can’t remember if it’s in 2015r2 or later.

@erin jamroz — since you’re in the beta program, have you tried this in the current beta?

@Thomas Tempelmann – I am not seeing behavior like that. Instead the connection closes without any kind of close call, then I can’t get it back.
@Greg O’Lone – No I do not have two IDE’s runnning and I have not tried it in the current beta. I will give it a shot.

Here is the code:

[code] // fix fb 3230 - njp - Sep 4, 2008
Try
parent = Volume(0).Child(“tmp”)
Catch err As NilObjectException
parent = Nil
End Try

If parent Is Nil Or Not parent.exists Or Not parent.IsWriteable Then
// more fixes for fb 3230 - njp - Sep 16, 2008 … mostly becuase WUBI installed Ubuntu is really odd and Volume(0) fails
Try
parent = Volume(0).Child(“var”).Child(“tmp”)
Catch err As NilObjectException
parent = Nil
End Try
End If

If parent Is Nil Or Not parent.exists Or Not parent.IsWriteable Then
// more fixes for fb 3230 - njp - Sep 16, 2008 … mostly becuase WUBI installed Ubuntu is really odd and Volume(0) fails
Try
parent = SpecialFolder.Temporary
Catch err As NilObjectException
parent = Nil
End Try
End If

If parent Is Nil Or Not parent.exists Or Not parent.IsWriteable Then
// more fixes for fb 3230 - njp - Sep 16, 2008 … mostly becuase WUBI installed Ubuntu is really odd and Volume(0) fails
Try
parent = SpecialFolder.Home
Catch err As NilObjectException
parent = Nil
End Try
End If

// fix fb 3230 - njp - Sep 4, 2008
Try
Const ipcpath = “XojoIDE”
#If DebugBuild
Return parent.Child(“DEBUG”+ipcpath).ShellPath
#Else
Return parent.Child(ipcpath).ShellPath
#EndIf
Catch err As NilObjectException
Return “”
End Try[/code]

Which results in path = /tmp/XojoIDE
Now, I may be misunderstanding something, but at run time, shouldn’t there be a file there? Because when I look there is nothing.

I would also like to add that I am trying to use a desktop app to communicate with the IDE, not a console app, but looking at the code, I don’t think that should affect anything.

probably more like /private/tmp/XojoIDE (or whatever your boot volume is called)

and when you run the IDE you should see an item there
but its not a “file” in the sense of “text file”

/tmp is just a symlink to /private/tmp

And that is the point of my confusion, when the IDE is running on my machine, there is nothing there except for some com.apple stuff, which explains the name resolution error.

if there’s no item there you wont be able to talk to the IDE
that IS the listening IPCSocket

now WHY it can create it is an entirely different matter
could be permissions

So, just to clarify, when Xojo fires up, one of the steps is to create that socket? So, in theory it should exist and be listening the whole time the IDE is running?

Alright, I have been running more testing and found out several things.
@Thomas Tempelmann was correct, the IPC socket would only work every other time. But, in addition to this, I was never able to se that behavior because I could not get the IPC socket to ever instantiate when trying to launch a .xojo_script file, I was only able to get it to appear when launching a .xojo_project file.

But, all of this does not seem to matter now because as @Greg O’Lone suggested, I tried this all in the beta and the IDE seems to be creating the /private/tmp/XojoIDE socket as it should be.

Thank you Greg, and thank you guys for working through bugs as they get reported

It does if it can
If not then it doesn’t care. It wont cause the IDE to not work or crash etc.
You just wont be able to connect to it from outside tools

I use AppleScript and never had problems

//IDEScriptTrigger.scpt on run {appPath, script_contents} tell application appPath «event RBaescpt» script_contents end tell end run

[code]dim script As String = “beep”

dim appPath As String = “KM:Applications:Xojo 2015 Release 2.3:Xojo 15r2.3.app”

IDEScriptTrigger(appPath, script)[/code]
The use of appPath allows me to send it to specific versions of Xojo, but could be dropped and done as ‘tell application “Xojo”’