Autodiscover not updating when connected to a console app

Hello all.
Something very strange is happening. I had to port a GUI app to a Service App, running on windows in this case. The server is the Service, the client remains a GUI app. Both are compiled to 32bit windows. Previously 2 GUI apps, of virtually the same code, would indicate properly when a connection was gained or lost/dropped etc. However in this new case, when the Service app is shut down, the GUI app (Client) does not see the connection drop.

If I check the AutoDiscovery.GetMemberList the member list is not changing. In fact, if I restart the Service, the GUI sees the same IP/Member 2x.

Why is this and what can I do to correct? In my case, it leads the user to think there is a connection, when there really is not.

Also, the tests were performed on the same 2 pc’s, on the same network.

Any ideas would be appreciated!

Thank you,

At what point are you calling LeaveMulticastGroup, in what event?
Have you confirmed (through logging to a file/event view/debugging) that LeaveMulticastGroup is being called by the Service App?

Hi Julian - Thank you for your reply!

The method LeaveMulticastGroup is not called in either case.

I am shutting down/killing the two apps the same, in windows, by clicking the X. By performing the click on the X, on the other end, the Subclassed AutoDiscover fires the Sub MemberLeft(ip as String).

When killing like this, there does not appear to be a lot of control over what happens. But again, both the GUI and Service/Console app is killed seemingly the same way.


First thing, I would code in AutoDiscovery.LeaveMulticastGroup to your Application.Close to ensure that the leave notification is being sent to the network. There might be a bug with AutoDiscovery where its not sending out a notification when its unloaded in a service.

Also, I’d call UpdateMemberList before calling GetMemberList

I’ll have a play with it and see if I can replicate the problems you are having.

Or are you calling Unregister at all?

Hi Julian,
I will recheck for unregister, but I know that I am not using UpdateMemberList. I’m going to try that first.

Will let you know tomorrow.

Thanks again!

I’d check for the use of Unregister first, if you’re not using that you would see the problem you’re getting.

The docs for AutoDiscovery are a bit of a dogs dinner.

Register says to use .Connect before calling Register, but the Xojo example doesn’t use it!

There’s Register and JoinMulticastGroup, the Xojo AutoDiscovery example doesnt use JoinMulticastGroup, so who knows what that point of that is (same for Unregister and LeaveMulticastGroup).

Registering twice to a group causes AutoDiscovery to break on that client, thus ignore all future notification (this might be your issue).

Hi Julian,

Thank you for your reply - my apologies for my late reply! Got interrupted with my wedding anniversary this week, but will be looking at this probably tomorrow!

Thank you again for the hints and direction!

You may need to call doEvents in your loops.
Or at least socket.poll to give time for socket events.