mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00
getting hostname from ip (for all, cuz hostname can have dots too
This commit is contained in:
parent
e8e9e12302
commit
0e2d0f07e8
@ -46,14 +46,13 @@ public:
|
|||||||
char ip[MAX_STR_LENGTH] = "";
|
char ip[MAX_STR_LENGTH] = "";
|
||||||
strcpy(ip, hostname_or_ip);
|
strcpy(ip, hostname_or_ip);
|
||||||
|
|
||||||
|
// convert hostname to ip
|
||||||
|
char* ptr = ConvertHostnameToIp (hostname_or_ip);
|
||||||
|
if (ptr == NULL)
|
||||||
|
return;
|
||||||
|
strcpy(ip, ptr);
|
||||||
|
|
||||||
// construct address
|
// construct address
|
||||||
if (strchr (hostname_or_ip, '.') == NULL) {
|
|
||||||
// convert hostname to ip
|
|
||||||
char* ptr = ConvertHostnameToIp (hostname_or_ip);
|
|
||||||
if (ptr == NULL)
|
|
||||||
return;
|
|
||||||
strcpy(ip, ptr);
|
|
||||||
}
|
|
||||||
sprintf (serverAddress, "tcp://%s:%d", ip, portno);
|
sprintf (serverAddress, "tcp://%s:%d", ip, portno);
|
||||||
|
|
||||||
// create context
|
// create context
|
||||||
|
Loading…
x
Reference in New Issue
Block a user