+char* getinterfaceip()
+{
+ char hostname[256];
+ char *IP;
+ struct hostent *host_entry;
+ int retVal;
+ retVal = gethostname(hostname, sizeof(hostname));
+ if ( retVal == -1 )
+ return NULL;
+ host_entry = gethostbyname(hostname);
+ if ( host_entry == NULL )
+ return NULL;
+ IP = inet_ntoa(*((struct in_addr*) host_entry->h_addr_list[0]));
+ return IP;
+}
+