Question about IPCSocket Listen

Hi there.

A question about IPCSocket.

I’m running on Mac Sonoma, Xojo Version 2025 Release 2.

I want to know if a program (not an Xojo Program, another one, VLC). When I look at the IPCSocket Example, I never see the .Listen used.

How do I do this?
I tried connecting and then Listen, but that corrupted my VLC program which I had to re-install.

How do I do this?

Regards

from Notes in online docu ..

IPCSocket works similarly to a regular TCPSocket, but instead of using an IP address and Port number, a local file path is used, leading to a so-called socket file. The same path must used on both ends of the connection, and it should preferably be a unique file location inside a temporary folder that’s not usually visible to the user. The file might remain in existance even after closing the connection, so you should delete any leftover files from previous connections when you make a new connection.

To connect, first one side must invoke Listen after having set the Path. Then the other can connect to the socket file using the Connect method.

To terminate the connection, call the Close method. This will invoke the Error event on the other end, with its RuntimeException.ErrorNumber set to 102.

I never see the .Listen used.

its a Listen Button? and then it called CommSocket.Listen

What are you trying to do here? I feel like there’s a lot missing from your post, lol.

1 Like

Ah.

I missed that Markus. Time to clean my glasses and read with BOTH eyes.

1 Like

Hi Eric.

What I am trying to do is as follows.

One of my programs calls VLC. But if the user quits VLC I want my program to end as well.

From what I read from the threads, you use an IPCSocket you can “communicate” between programs, and you can listen to another program, and if it doesn’t respond or not “be there” you can act on it.

Regards

You could have your Xojo app periodically check to see if VLC is running. No messing around with sockets that way.

I see.

An IPCSocket requires both programs to participate. If VLC wasn’t designed to communicate this way (which I assume is true), then an IPCSocket isn’t the solution.

I would suggest you launch VLC in a Shell object with Mode=Asynchronous. When/if the user quits VLC, the Shell’s Completed event will fire and your code can react accordingly.

1 Like

This requires that the other program
a) is using IPC
b) is using the same path for IPC
c) has connected

It isn’t likely that VLC is doing any of that.

You can embed VLC directly into your app rather than invoking it and waiting for it to quit.

Or

2 Likes

Hi Andrew.

I tried that, but couldn’t get it to work, which is why I went the other way.

What did you try with which code? Which problems did you have?

Hi Beatrix.

It was a while ago… so… be forgiving.

I followed the plugin installation from their youtube channel and then after fighting with dependancies (finally just putting all of the plug ins in the Xojo / Plugins folder) tried with one of the examples they have.

I used the example from the MBS software website (Monkeybread Xojo plugin - Example: /VLC/Show video sample)

It kept throwing all sorts of … weird errors…

I’m trying to find my test program, but it might have been on my old computer that recently gave up the ghost recently.

If someone has a program that uses MBS vlc plugins, I’d be happy to view it.

Regards

Just tried the MBS VLC Video sample on Sequoia 15.5 with no issues. Of course you need an test.mp4 file lying on the Desktop.

Thomas, which plugins do you have in the Xojo Plugins Folder?

And I’m running Mac Sonoma…

Regards

So for MBS Xojo Plugins, you always need to check the dependencies. I think you may need these

  • MBS Xojo VLC Plugin
  • MBS Xojo Main Plugin
  • MBS Xojo MacCG Plugin for CGContextMBS
  • MBS Xojo MacBase Plugin
  • MBS Xojo MacCloud Plugin for NSFileManager
  • MBS Xojo MacCF Plugin for MacCG
  • MBS Xojo Util Plugin for SoftDeclareMBS

thanks Christian.

I did check the dependancies when I looked at the webpage,

Required plugins for this example: MBS VLC Plugin, MBS Util Plugin

but kept getting issues so I wound up putting the entire thing in my Plugin Folder…

I’ll try using your dependancies, and the program, try again and advise.

Regards

Hi Julia.

How do you check to see if VLC is running.

I’ve tried looking at the PID, by name but I’m probably not doing it correctly.

Regards

Iterate over running processes and find any with the name you’re looking for. Can probably be done with declares or Shell, but MBS makes it easy:

Thanks.

I was looking at running a psgrep command to find out if the program was running but this looks interesting.

I’ll give it a try and advise!

Once again thanks.

Regards

1 Like

Hi Everyone.

First thank you for all the help you gave. Pointed me in what I consider the “right” direction.

While I chose NOT to use the MBS Remote Control, I did use the Linux Command:

pgrep

in my case:

pgrep VLC

This way if I get back a "" instead of a number, I know the program isn’t running and can quit my program.

Best way?
Dunno.
My way?
Yes.
Now to see how WELL it works :smiley:

Stay tuned.

1 Like