Restart Bonjour service
Stop Bonjour service:
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
Start Bonjour service:
sudo launchctl load /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
A while back I had a problem where one of my Macs would periodically fail to broadcast its Bonjour name for things like print and file serving. Rebooting the computer would resolve the problem for a time, but it would always come back. Rather than having to reboot my computer all the time, I searched for and found this handy set of commands for stopping and starting the Bonjour service which would do the trick until the problem occurred again. Since this was a service, it was great not having to reboot. I eventually solved the problem, which if memory serves was caused by my router, but I felt it was handy to hold onto this in case I ever needed to stop or restart the Bonjour service again. These commands need to be run as administrator, which is why they are prefixed with the sudo command. You will be prompted to enter your admin password to execute them.