dislite/src/dislite_vc.cxx
//----------------------------------------------------------------------------------------
// This private function will receve integrator IP address and port.
// It will return FALSE if no integrator detected.
// It will receve TRUE and it will fill m_WhereIntegrator structure with port and IP 
// address of the integrator if everything is OK.
// RUN THIS FUNCTION DIRECTLY AFTER QueryIntegrationService
//----------------------------------------------------------------------------------------
This private function will receve integrator IP address and port.
It will return FALSE if no integrator detected.
It will receve TRUE and it will fill m_WhereIntegrator structure with port and IP
address of the integrator if everything is OK.
RUN THIS FUNCTION DIRECTLY AFTER QueryIntegrationService
This private function will receve integrator IP address and port . It will return FALSE if no integrator detected . It will receve TRUE and it will fill m_WhereIntegrator structure with port and IP address of the integrator if everything is OK . RUN THIS FUNCTION DIRECTLY AFTER QueryIntegrationService
int ReceveIntegrationService() {
char serviceName[1024];
    char hostName[1024];
    gethostname(hostName,1024);
	char        userName[1024];
	char*		userNameEnv;
	userNameEnv = getenv("USER");
	if(userNameEnv == NULL) {
		DWORD nUserNameSize = 1024;
		GetUserName(userName,&nUserNameSize);
	} else {
		strcpy(userName,userNameEnv);
	}
	strcpy(serviceName,hostName);
	strcat(serviceName,":");
	strcat(serviceName,userName);
	strcat(serviceName,":");
	strcat(serviceName,"Editor:Microsoft Visual Studio");
	int port;
	int address;
    int res = NameServerGetService(serviceName, port, address); 
    memset(&IntegratorAddr,0,sizeof(SOCKADDR_IN));
    IntegratorAddr.sin_family=AF_INET;
    IntegratorAddr.sin_port=htons(port);
    static struct hostent *ent = gethostbyname(hostName);
    IntegratorAddr.sin_addr=*(in_addr *)*ent->h_addr_list;
    return res;
}
int ReceveIntegrationService ( ) { char serviceName [ 1024 ] ; char hostName [ 1024 ] ; gethostname ( hostName , 1024 ) ; char userName [ 1024 ] ; char * userNameEnv ; userNameEnv = getenv ( " " ) ; if ( userNameEnv == NULL ) { DWORD nUserNameSize = 1024 ; GetUserName ( userName , & nUserNameSize ) ; } else { strcpy ( userName , userNameEnv ) ; } strcpy ( serviceName , hostName ) ; strcat ( serviceName , " " ) ; strcat ( serviceName , userName ) ; strcat ( serviceName , " " ) ; strcat ( serviceName , " " ) ; int port ; int address ; int res = NameServerGetService ( serviceName , port , address ) ; memset ( & IntegratorAddr , 0 , sizeof ( SOCKADDR_IN ) ) ; IntegratorAddr . sin_family = AF_INET ; IntegratorAddr . sin_port = htons ( port ) ; static struct hostent * ent = gethostbyname ( hostName ) ; IntegratorAddr . sin_addr = * ( in_addr * ) * ent -> h_addr_list ; return res ; }
This private function will receve integrator IP address and port.
This private function will receve integrator IP address and port .
// Getting current host name   // Getting current user name