I would suggest using a client-server socket implementation. You can perform an IP broadcast and have your server respond to specific clients. Once the initial response is made, you can transfer data whichever way you like.
It basically boils down to:
- Client creates a socket connecting to the broadcast IP on a preset port, and listens for incoming connections
- Server listens on that port and responds to any incoming connections
- Client receives a response from the server and replies with details about its client identity
- Any other data is transmitted through the now established socket connection
Bear in mind that by using a socket, you're riding on a bare IP datagram and simply providing its body in raw binary data. This means that you'll have to manually write your protocol in order to cope with request and response types, dropped packets and any other limitations of IP. You may want to look around for a TCP implementation layer or something more sophisticated for your purpose.