Phantom Service

To learn how to do peer to peer communication I downloaded the TicTacToe example into my MacStudio from: https://developer.apple.com/documentation/network/building_a_custom_peer-to-peer_protocol

I then loaded it into Xcode, compiled it, deployed to an iPhone 14 over a Lightning cable, and ran it. I developed code for the MacStudio in an attempt to communicate with it. The MacStudio at first detected the service but for some reason it has quit doing so.

The command: dns-sd -B _services._dns-sd._udpoutputs this as one of its lines:

A/R  Flags  if Domain  Service Type        Instance Name
Add     3       17 .     tcp.local.        _tictactoe 

(The time stamp column deleted for clarity) This line remains the command's output even after the iPhone the TicTacToe app has been shutdown, and after in the MacStudio Xcode, and the simulator it opens, is shutdown. In an attempt to find out what application is still advertising this Bonjour service I installed Discovery from:

https://apps.apple.com/us/app/discovery-dns-sd-browser/id305441017

When run the _tictactoe service instance does show in its list also also. But when I left click this item in that list to get a detail view of it I get a perpetual spinning wheel, and just to the right of it the message "Scanning...". No information is displayed. What does that mean in regard to what program is still advertising this service? What other ways are available to find this program so it can be shut down? Is it possible that this presence in that list, and in the output of the dns-sd is just a phantom vestige of an application that is not longer running? If this is a case how can the service offering be shutdown?

I found the answer to this in Question #4 no this webpage: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/NetServices/Articles/faq.html

4. When I disconnect a device from a network, does it remain visible?

Yes, for a while. Eventually, the DNS record reaches its time-to-live interval and disappears. As an app developer, if you connect to a host using Bonjour and the connection fails, you can ask the Bonjour to reconfirm the record. This process is described further in NSNetServices and CFNetServices Programming Guide.

What I saw as phantom were the remaining DNS records. They eventually disappeared as their TTL (Time To Live) expired.

Phantom Service
 
 
Q