WWW.ИСХОДНИКИ.РУ cpp.sources.ru
java.sources.ru web.sources.ru soft.sources.ru
jdbc.sources.ru asp.sources.ru api.sources.ru

  Форум на исходниках
  C / C++ / Visual C++
  GetHostByAddr как сделать в C Builder 5.0 (+)

СПРОСИТЬ  ОТВЕТИТЬ
профайл | регистрация | faq

Автор Тема:   GetHostByAddr как сделать в C Builder 5.0 (+)
northfield опубликован 06-09-2001 13:57 MSK   Click Here to See the Profile for northfield   Click Here to Email northfield  
Собственно нужно описание процесса, а лучше пример для билдера, нашел такую статью для Visual C на этом сервере а как перетащить алгоритм на Builder не догоняю.
m_fox опубликован 07-09-2001 06:44 MSK     Click Here to See the Profile for m_fox  Click Here to Email m_fox     
Не забудь подключить библиотеку wsock32.lib
#include <winsock2.h>
#include <stdio.h>

void main()
{

WORD wVersionRequested;
WSADATA wsaData;
int err;

wVersionRequested = MAKEWORD( 2, 2 );

err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 ) {
/* Tell the user that we could not find a usable */
/* WinSock DLL. */
return;
}

/* Confirm that the WinSock DLL supports 2.2.*/
/* Note that if the DLL supports versions greater */
/* than 2.2 in addition to 2.2, it will still return */
/* 2.2 in wVersion since that is the version we */
/* requested. */

if ( LOBYTE( wsaData.wVersion ) != 2

m_fox опубликован 07-09-2001 06:46 MSK     Click Here to See the Profile for m_fox  Click Here to Email m_fox     
2pure!!!!!!!!!!!!!!!!
сделай так, чтобы по знаку ИЛИ сообщение не ОБРЕЗАЛОСЬ

#include <winsock2.h>
#include <stdio.h>

void main()
{

WORD wVersionRequested;
WSADATA wsaData;

wVersionRequested = MAKEWORD( 2, 2 );

WSAStartup( wVersionRequested, &wsaData );

struct hostent *_host;
ULONG uIPAddr=inet_addr("207.46.230.229");
_host=gethostbyaddr((char*)&uIPAddr,4,AF_INET);
if (_host!=NULL)
{

printf("%s",_host->h_name);
}
WSACleanup( );
}

northfield опубликован 07-09-2001 13:58 MSK     Click Here to See the Profile for northfield  Click Here to Email northfield     
Спасибо большое попробую
purpe опубликован 07-09-2001 14:05 MSK     Click Here to See the Profile for purpe  Click Here to Email purpe     
2m_fox:
если б знал как, то давно уже сделал :)
m_fox опубликован 07-09-2001 18:20 MSK     Click Here to See the Profile for m_fox  Click Here to Email m_fox     
понятно :)
а где скрипт форума взял?

СПРОСИТЬ  ОТВЕТИТЬ
Перейти:


E-mail | WWW.ИСХОДНИКИ.RU

Powered by: Ultimate Bulletin Board, Freeware Version 5.10a
Purchase our Licensed Version- which adds many more features!
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 2000.