serverstart/src/serverstartdlg.cpp
//--------------------------------------------------------------------------------
// This function will ask nameserver for all available pset servers.
//--------------------------------------------------------------------------------
This function will ask nameserver for all available pset servers.
This function will ask nameserver for all available pset servers .
void CServerStartDlg::FillServiceList(int mode) {
NameServerServiceList* services;
const char* servNamePtr;
char host[1024];
CString name;
CString templ;
int service_port,tcp_addr;
	gethostname(host,1024);
    templ="Discover:";
	templ+=host;
    m_ServiceList.ResetContent();
    NameServerGetListOfServices(&services);
	while(1) {
		if(services==NULL) break;
		servNamePtr = services->getName();
		if(servNamePtr==NULL) break;
		name=servNamePtr;
		if(NameServerGetService(name,service_port,tcp_addr)==1) {
		    if(mode == 0)  {
                if(name.Find(templ)==0)        
                     m_ServiceList.AddString(name);
			} else {
			    if(name.Find("Dislite:")==0) {
				    if(name[(int)strlen("Dislite:")]!='.') {
                        m_ServiceList.AddString(name);
					}
				}
			}
		}
		services=services->getNext();
	}
}
void CServerStartDlg :: FillServiceList ( int mode ) { NameServerServiceList * services ; const char * servNamePtr ; char host [ 1024 ] ; CString name ; CString templ ; int service_port , tcp_addr ; gethostname ( host , 1024 ) ; templ = " " ; templ += host ; m_ServiceList . ResetContent ( ) ; NameServerGetListOfServices ( & services ) ; while ( 1 ) { if ( services == NULL ) break ; servNamePtr = services -> getName ( ) ; if ( servNamePtr == NULL ) break ; name = servNamePtr ; if ( NameServerGetService ( name , service_port , tcp_addr ) == 1 ) { if ( mode == 0 ) { if ( name . Find ( templ ) == 0 ) m_ServiceList . AddString ( name ) ; } else { if ( name . Find ( " " ) == 0 ) { if ( name [ ( int ) strlen ( " " ) ] != ' ' ) { m_ServiceList . AddString ( name ) ; } } } } services = services -> getNext ( ) ; } }
This function will ask nameserver for all available pset servers.
This function will ask nameserver for all available pset servers .
// All valid services must start as "Discover:<host>"