Can not connect to MQTT Broker with TLS enabled using LWIP and MbedTLS

Hello, I’m trying to connect to an MQTT broker with SSL/TLS enabled. This server only has a DNS, so I tried dns_gethostbyname() to get it’s IP address but it’s not working. As my knowledge, this function will send a request to the target DNS and get the IP address to use for mqtt_client_connect() function. Unfortunately, maintainer of the broker said that if an MQTT message was sent through IP address with TLS enable, it will be rejected (I also can not get the IP address of this DNS through dns_gethostbyname()). So anyone has the experience in this can tell me how to deal with this problem?

Many thanks,
Hieu