#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#ifdef LINUX
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#else
#include <windows.h>
#include <winsock.h>
#endif
void Resuelve_Nombre(char * Servidor);
#ifndef LINUX
int WINAPI WinMain( HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow )
{
Resuelve_Nombre("dominio.es");
return 1;
}
#else
int main(int argc, char *argv[])
{
Resuelve_Nombre("dominio.es");
return 1;
}
#endif
void Resuelve_Nombre(char * Servidor)
{
#ifndef LINUX
WSADATA wsaData;
if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) {
//cerr << "WSAStartup fallo";
exit(1);
}
#endif
struct hostent *hServ;
if ((hServSMTP=gethostbyname(Servidor)) == NULL) { // Obtener informaci�n del host
//cerr << "error en gethostbyname";
exit(1);
}
// MessageBox(NULL,hServSMTP->h_name ,inet_ntoa(*((struct in_addr *)hServSMTP->h_addr)),NULL);
// printf("Host name : %sn", h->h_name);
// printf("IP Address : %sn", inet_ntoa(*((struct in_addr *)h->h_addr)));
#ifndef LINUX
WSACleanup() ;
#endif