newntui/activex/msdevintegrator/src/msdevintegratorctl.cpp
//----------------------------------------------------------------------------------------
// 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 CMSDEVIntegratorCtrl::ReceveIntegrationService() {
char* serviceName="Discover:Integrator";
CString fullName;
int port;
int address;
     fullName=serviceName;
	 fullName+=":";
	 char hostName[1024];
	 gethostname(hostName,1024);
	 fullName+=hostName;
     int res = NameServerGetService(fullName.GetBuffer(20), port, address);
	 memset(&m_WhereIntegrator,0,sizeof(SOCKADDR_IN));
	 m_WhereIntegrator.sin_family=AF_INET;
	 m_WhereIntegrator.sin_port=htons(port);
	 char buf[1024];
     gethostname(buf, 1024);
     static struct hostent *ent = gethostbyname(buf);
	 m_WhereIntegrator.sin_addr=*(in_addr *)*ent->h_addr_list;
	 return res;
}
int CMSDEVIntegratorCtrl :: ReceveIntegrationService ( ) { char * serviceName = " " ; CString fullName ; int port ; int address ; fullName = serviceName ; fullName += " " ; char hostName [ 1024 ] ; gethostname ( hostName , 1024 ) ; fullName += hostName ; int res = NameServerGetService ( fullName . GetBuffer ( 20 ) , port , address ) ; memset ( & m_WhereIntegrator , 0 , sizeof ( SOCKADDR_IN ) ) ; m_WhereIntegrator . sin_family = AF_INET ; m_WhereIntegrator . sin_port = htons ( port ) ; char buf [ 1024 ] ; gethostname ( buf , 1024 ) ; static struct hostent * ent = gethostbyname ( buf ) ; m_WhereIntegrator . 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 .