I know all that, here's the code i used in MSVC++ 6 :
Code:
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <winsock.h>
int main( int argc, char *argv[] )
{
int is_ip;
struct in_addr address;
if( argc != 2 ) return 1;
is_ip = inet_addr( argv[1] );
if( is_ip != -1 ) {
address.s_addr = is_ip;
if( gethostbyaddr( ( const char* )&address, sizeof( struct in_addr ), AF_INET )
== NULL ) {
fprintf( stderr, "gethostbyaddr() failed" );
return 1;
}
} else {
if( gethostbyname( argv[1] ) == NULL ) {
fprintf( stderr, "gethostbyaddr() failed" );
return 1;
}
}
puts( "Alright, reachable." );
return 0;
}
and... all i seem to get is the failure msg. I run it like so in the console:
>onlinecheck cprogramming.com
OR
>onlinecheck [IP]
which always results in failure. Any ideas?