diff options
Diffstat (limited to 'sal/qa/osl/socket/sockethelper.cxx')
-rw-r--r-- | sal/qa/osl/socket/sockethelper.cxx | 99 |
1 files changed, 6 insertions, 93 deletions
diff --git a/sal/qa/osl/socket/sockethelper.cxx b/sal/qa/osl/socket/sockethelper.cxx index 4568f042dc15..c6ee81e2a363 100644 --- a/sal/qa/osl/socket/sockethelper.cxx +++ b/sal/qa/osl/socket/sockethelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -66,15 +67,6 @@ sal_Bool compareSocketAddr( const ::osl::SocketAddr & addr1 , const ::osl::Socke return ( ( sal_True == compareUString( addr1.getHostname( 0 ), addr2.getHostname( 0 ) ) ) && ( addr2.getPort( ) == addr2.getPort( ) ) ); } -/*char * oustring2char( const ::rtl::OUString & str ) -{ - rtl::OString aString; - aString = ::rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ); - t_print("oustring2char %s\n", aString.getStr( ) ); - sal_Char * sStr = aString.getStr( ); - return (char *)sStr; -}*/ - /** print a UNI_CODE String. And also print some comments of the string. */ void printUString( const ::rtl::OUString & str, const char* msg) @@ -174,11 +166,11 @@ void printUString( const ::rtl::OUString & str, const char* msg) if ( returnVal.equals( rightVal ) ) return aUString; aUString += ::rtl::OUString::createFromAscii(msg); - aUString += ::rtl::OUString::createFromAscii(": the returned value is '"); + aUString += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(": the returned value is '")); aUString += returnVal; - aUString += ::rtl::OUString::createFromAscii("', but the value should be '"); + aUString += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("', but the value should be '")); aUString += rightVal; - aUString += ::rtl::OUString::createFromAscii("'."); + aUString += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'.")); return aUString; } @@ -287,87 +279,6 @@ sal_Bool ifIpv4is( const ::rtl::ByteSequence Ipaddr, sal_Int8 seq1, sal_Int8 seq return sal_False; } -/** if the IP or hostname is availble( alive ) -*/ -/*sal_Bool ifAvailable( const char * stringAddrOrHostName ) -{ - sal_Bool result; - int p[2]; - sal_Char buffer[2000]; - char stringhost[20]; - strcpy(stringhost, stringAddrOrHostName ); - - result = sal_False; - if (pipe (p) == 0) - { - pid_t pid; - int nStatus; - pid = fork(); - if (pid == 0) - { -#if ( defined LINUX ) - char *argv[] = - { - "/bin/ping", - "-c", "3", - "-W", "3", - stringhost, - NULL - }; -#endif -#if ( defined SOLARIS ) - char *argv[] = - { - "/usr/sbin/ping", - stringhost, - "3", - NULL - }; -#endif - close (p[0]); - dup2 (p[1], 1); - close (p[1]); -#if ( defined LINUX ) - execv ("/bin/ping", argv); -#endif -#if ( defined SOLARIS ) - execv ("/usr/sbin/ping", argv); -#endif - // arriving here means exec failed - _exit(-1); - } - else if (pid > 0) - { - sal_Int32 k = 0, n = 2000; - close (p[1]); - if ((k = read (p[0], buffer, n - 1)) > 0) - { - buffer[k] = 0; - if (buffer[k - 1] == '\n') - buffer[k - 1] = 0; -#if ( defined LINUX ) - char strOK[] = "bytes from"; -#endif -#if ( defined SOLARIS ) - char strOK[] = "is alive"; -#endif - if (strstr( buffer, strOK ) != NULL ) - result = sal_True; - t_print("buffer is %s\n", buffer ); - } - close (p[0]); - waitpid (pid, &nStatus, 0); - } - else - { - close (p[0]); - close (p[1]); - } - - } - return result; -}*/ - sal_Bool ifAvailable( rtl::OUString const& strAddrOrHostName ) { ::osl::ConnectorSocket aSocket( osl_Socket_FamilyInet, osl_Socket_ProtocolIp, osl_Socket_TypeStream ); @@ -399,3 +310,5 @@ sal_Bool ifAvailable( rtl::OUString const& strAddrOrHostName ) } return sal_True; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |