A lot of the back story here is covered by Technote 2152 Document Transfer Strategies. I suggest you give it a read.
Note TN2152 hasn’t been updated in a while but that’s probably OK in this case because your requirements put you in a space that hasn’t changed much since its last update.
If were in your shoes I’d do the following:
On the server, NSNetService to advertise its presence.
On the client, use NSNetService to find the server.
Use HTTP as the protocol. This is well supported on the client (via NSURLSession) and it’s easy to implement the server side using Python.
The major gotcha here is security. The fundamental building block here is HTTP (that is, HTTP over TLS) but putting them together for a peer-to-peer app is quite tricky.
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"