Where did sharingd file find the IP address it trying to connect?
macOS implements mDNS - Multicast DNS to find other devices on the same network segment. Basically, it says - who can share files and if the other IP answers - you have a connection that can be made if you click on that host in Finder (for one of many possible instances)


https://developer.apple.com/bonjour/
http://multicastdns.org


It's called Bonjour when it's wrapped up in IPv4/IPv6 as well as bluetooth zero configuration networking and this tech powers things like AirPlay, Printer Sharing, handoff / continuity and more.

So to answer your question, it found it by asking on your network. It's not clear why you have 192.168.5.255 and 192.168.2.255 both as broadcast networks, but that's not necessarily wrong if you have your network set up like that.