Products  | Support & Services  | News & Events  | Partners  | Policies  | Global Sites
Home > Support > Hummingbird Connectivity Products > Exceed >  Gethostname function call problem Print View   Contact Me
Connectivity Support


Gethostname function call problem
PROBLEM:

When using gethostname function to retrieve hostname, sometimes it returns xliblocalhost instead of current host name.

SOLUTION:

You need to open a connection to make gethostname function working properly.
Add the following lines to the code before calling gethostname and the problem will be fixed:

#include <X11/Xlib.h>
.....
Display *dpy = XOpenDisplay(NULL);