|
��������
gethostent, gethostbyaddr, gethostbyname, sethostent,
endhostent - �������� �������� � ������� ������� ������
���������
#include <netdb.h> struct hostent *gethostent() struct hostent *gethostbyname(name) char *name; struct hostent *gethostbyaddr(addr,len,type) char *addr; int len,type; sethostent(stayopen) int stayopen endhostent()
��������
������� gethostent, gethostbyname � gethostbyaddr ����������
��������� �� ������, ������� ��������� ��������� � �����������
������ � ������� ������� �� /etc/hosts:
struct hostent { char *h_name; /* ����������� host-��� */ char **h_aliases; /* ������ ����������� */ int h_addrtype; /* ��� ������ */ int h_length; /* ����� ������ */ char *h_addr; /* ����� */ };
�������� ���������
h_name | ����������� ��� ������� ������. |
---|---|
h_aliases | ������ �������������� ���� ������� ������, �������������� �����. |
h_addrtype | ��� ������������� ������; � ��������� ����� ������ AF_INET. |
h_length | ����� ������ � ������. |
h_addr | ��������� �� ������� ����� ��� ������� ������. |
������� gethostent ��������� ��������� ������ �����, � ������ ������������� �������� ���� ����.
������� sethostent ��������� � ��������� � ������ �����. ���� ���� stayopen ����� ��������� ��������, ������� �� �� ����� ����������� ����� ������� ������ ������� gethostent.
������� endhostent ��������� ����.
������� gethostbyname � gethostbyaddr ��������������� ������������� ���� � ������ ������ � ������� ����� ��� ������ ������� ������.
�����
/etc/hosts
�����������
�� ���������� ����� ����� ��� � ������ ��������� ������ ������������ ������� ���������.
���������
��� ���������� ����������� � ����������� �������, ������� �
����� ���������� �� ���������� �����������. ����� ����� �����
������ ������ Internet.
|