There is:
char* input = "google.com"; //char* input = "192.168.1.1";
It is necessary that the function could distinguish the DNS name from the IP. How to implement. Through try {} catch {} trying to process the input string with gethostbyname () or inet_add ()? Or is there another option?