Server auto discovering feature

Hi guys, I already have my mqtt aplication running.
My nodemcu board is sending mqtt paquets to server properly.
Now, my server lan config is done via dhcp , so it means that everytime it changes , i need to change settings in my boards.
Is there some way to force my nodemcus to scan an specific port on the assigned network segment ?
After find tcp connection on that port, it should set this ip to use as server.

This is my first post here,

So, make socket connection to each IP address in LAN network on MQTT port 1883. If connection will be sucessful, save IP and use it for all connections.

Good idea , lets try!!!

or also..
if it is supported you can use mDNS service.
So your server will have mDNS like myserver.local
and automatically DHCP address will be covered by that mDNS local domain name.