I'm currently writing a Java application that uses TCP/IP to communicate. What i'm trying to accomplish is to get the client to easy find the server and connect by sending some message out.
The question now is: What can i do to make the client discover the server?
Is there a way i can send a message to the router (DHCP-server maybe) that tells it that I'm using this service? Then the client could check if there is anything like that on the router (DHCP-server) and connect to the appropriate IP.
Hopefully someone can help.
You can use UDP broadcast. Here some details about implementation.
Check out zeroconf. It is a multicast-dns solution for service advertisement and discovery. The protocol was originally by Apple as the bonjour protocol. There is also a popular open source implementation of the protocal called Avahi.
There is a java library avahi4j which maybe helpful. I personally have no first hand experience with avahi4j but has used avahi for other non java projects.
Be aware that this approach will only work with the the broadcast domain of the local sub-net.