Reset IPC Socket for IDE Communicator

Since a while I can only send an IDE script with the IDE Communicator once. When trying to connect again there is a “Socket Error”. As far as I remember the IDE Communicator uses an IPC socket. Which work with a file. How do I reset the socket?

The original protocol was designed to be a one-shot command. Try using the newer JSON based protocol version 2.

The code says that the protocol is version 2:

OutputArea.Text = “”

// Send initial JSON to indicate to tell Xojo to use IDE Communicator v2 protocol
Dim js As New JSONItem
js.Value(“protocol”) = 2
IDECommSocket.Write(js.ToString + Chr(0))

DisconnectButton.Enabled = True
SendButton.Enabled = True

Protocol = 2[/code]

I’ll have to check when I get to my desk. The IDE is supposed to automatically restart the IPC connection if the socket closes or an error occurs.

That said, it can take a little bit of time. For instance, on macOS, the operating system doesn’t release the socket right away, so it takes between 10 and 30 seconds before the IDE can create a new socket.

Ahem. I thought the IPC socket would disconnect automatically. Adding a disconnect when closing the window fixes the problem.

FWIW, the reason it doesn’t disconnect in the v2 protocol is so you can get build errors back through the socket. It’s also worth noting that most (if not all) of the dialogs that would normally appear during a build are not shown and their content is returned in the JSON response.