vs_integration/src/SocketConnection.cpp
//-----------------------------------------------------------------------------
// This private function registers service port and TCP address in the name 
// server under the "MSDEV:<host>:SERVICE_NAME" name.
//-----------------------------------------------------------------------------
This private function registers service port and TCP address in the name
server under the "MSDEV::SERVICE_NAME" name.
This private function registers service port and TCP address in the name server under the " MSDEV :: SERVICE_NAME " name .
bool SocketConnection::RegisterService(int socket) {
	int test_sock = ConnectToNameServer();
	if (test_sock < 0) {
	    if(StartNameServer()!=0) {
		    for (int count = 0; count < 3000 ; count++) {
		        test_sock = ConnectToNameServer();
		        if (test_sock >= 0) {
  			        break;
				}
			}
	    }
	}
	if (test_sock >= 0) {
	    closesocket (test_sock);
	} else {
		return false;
	}
    struct sockaddr_in socketInfo;
    int len = sizeof(socketInfo);
	int res = -1;
    if(getsockname(socket, (struct sockaddr *)&socketInfo, &len) == 0) {
        res = NameServerRegisterService(ServiceName(),ntohs(socketInfo.sin_port));
	}
	if (res == 1) {
	    return true;
	} else {
	    return false;
	}
}
bool SocketConnection :: RegisterService ( int socket ) { int test_sock = ConnectToNameServer ( ) ; if ( test_sock < 0 ) { if ( StartNameServer ( ) != 0 ) { for ( int count = 0 ; count < 3000 ; count ++ ) { test_sock = ConnectToNameServer ( ) ; if ( test_sock >= 0 ) { break ; } } } } if ( test_sock >= 0 ) { closesocket ( test_sock ) ; } else { return false ; } struct sockaddr_in socketInfo ; int len = sizeof ( socketInfo ) ; int res = -1 ; if ( getsockname ( socket , ( struct sockaddr * ) & socketInfo , & len ) == 0 ) { res = NameServerRegisterService ( ServiceName ( ) , ntohs ( socketInfo . sin_port ) ) ; } if ( res == 1 ) { return true ; } else { return false ; } }
This private function registers service port and TCP address in the name
server under the "MSDEV:<host>:SERVICE_NAME" name.
This private function registers service port and TCP address in the name server under the " MSDEV : <host > : SERVICE_NAME " name .
// First, make sure that nameserv is up and accepting connections // Couldn't connect, so try to start nameserv // Wait for nameserv to start accepting connections