IceWalkers.com - Linux Software downloads and news
Name : Password :
Linux SoftwareLinux RPMLinux HowtosLink UsAboutAdvertise

freeaddrinfo (3)

getaddrinfo(3)             Linux Programmer's Manual            getaddrinfo(3)



NAME
       getaddrinfo - network address and service translation

SYNOPSIS
       #include<sys/types.h>
       #include<sys/socket.h>
       #include<netdb.h>

       intgetaddrinfo(constchar*node,constchar*service,
                       conststructaddrinfo*hints,
                       structaddrinfo**res);

       voidfreeaddrinfo(structaddrinfo*res);

       constchar*gai_strerror(int errcode);

DESCRIPTION
       The  getaddrinfo(3) function combines the functionality provided by the
       getipnodebyname(3),  getipnodebyaddr(3),  getservbyname(3),  and   get-
       servbyport(3)  functions  into  a  single  interface.   The thread-safe
       getaddrinfo(3) function creates one or more socket  address  structures
       that can be used by the bind(2) and connect(2) system calls to create a
       client or a server socket.

       The getaddrinfo(3) function is not  limited  to  creating  IPv4  socket
       address  structures;  IPv6  socket address structures can be created if
       IPv6 support is available.  These socket address structures can be used
       directly  by  bind(2)  or  connect(2),  to prepare a client or a server
       socket.

       The addrinfo structure used by this  function  contains  the  following
       members:

       structaddrinfo{
           int     ai_flags;
           int     ai_family;
           int     ai_socktype;
           int     ai_protocol;
           size_t  ai_addrlen;
           structsockaddr*ai_addr;
           char*ai_canonname;
           structaddrinfo*ai_next;
       };

       getaddrinfo(3)  sets  res to point to a dynamically-allocated link list
       of addrinfo structures, linked by the ai_next member.  There  are  sev-
       eral  reasons  why the link list may have more than one addrinfo struc-
       ture, including: if the network host is multi-homed;  or  if  the  same
       service  is  available  from multiple socket protocols (one SOCK_STREAM
       address and another SOCK_DGRAM address, for example).

       The members ai_family, ai_socktype, and ai_protocol have the same mean-
       ing  as the corresponding parameters in the socket(2) system call.  The
       getaddrinfo(3) function returns socket addresses in either IPv4 or IPv6
       address  family, (ai_family will be set to either PF_INET or PF_INET6).

       The hints parameter specifies the preferred socket type,  or  protocol.
       A  NULL hints specifies that any network address or protocol is accept-
       able.  If this parameter is not NULL it points to an addrinfo structure
       whose  ai_family, ai_socktype, and ai_protocol members specify the pre-
       ferred socket type.  PF_UNSPEC in ai_family specifies any protocol fam-
       ily   (either  IPv4  or  IPv6,  for  example).   0  in  ai_socktype  or
       ai_protocol specifies that any socket type or protocol is acceptable as
       well.  The ai_flags member specifies additional options, defined below.
       Multiple flags are specified by logically OR-ing  them  together.   All
       the  other  members  in the hints parameter must contain either 0, or a
       null pointer.

       The node or service parameter, but not both, may be NULL.  node  speci-
       fies  either  a  numerical  network  address (dotted-decimal format for
       IPv4, hexadecimal format for IPv6) or a network hostname, whose network
       addresses  are  looked  up and resolved.  If the ai_flags member in the
       hints parameter contains the AI_NUMERICHOST flag then the node  parame-
       ter  must be a numerical network address.  The AI_NUMERICHOST flag sup-
       presses any potentially lengthy network host address lookups.

       The getaddrinfo(3) function creates a link list of addrinfo structures,
       one for each network address subject to any restrictions imposed by the
       hints parameter.  ai_canonname is set to point to the official name  of
       the host, if ai_flags in hints includes the AI_CANONNAME flag.  ai_fam-
       ily, ai_socktype, and ai_protocol specify the socket  creation  parame-
       ters.  A pointer to the socket address is placed in the ai_addr member,
       and the length of the socket  address,  in  bytes,  is  placed  in  the
       ai_addrlen member.

       If  node  is NULL, the network address in each socket structure is ini-
       tialized according to the AI_PASSIVE flag, which is set in the ai_flags
       member  of  the  hints  parameter.   The network address in each socket
       structure will be left unspecified if AI_PASSIVE flag is set.  This  is
       used  by server applications, which intend to accept client connections
       on any network address.  The network address will be set to  the  loop-
       back interface address if the AI_PASSIVE flag is not set.  This is used
       by client applications, which intend to connect to a server running  on
       the same network host.

       service  sets  the  port  number  in the network address of each socket
       structure.  If service is NULL the port number will be left  uninitial-
       ized.

       The  freeaddrinfo(3)  function  frees the memory that was allocated for
       the dynamically allocated link list res.

RETURNVALUE
       getaddrinfo(3) returns 0 if it succeeds, or one of the  following  non-
       zero error codes:

       EAI_FAMILY
              The requested address family is not supported at all.

       EAI_SOCKTYPE
              The requested socket type is not supported at all.

       EAI_BADFLAGS
              ai_flags contains invalid flags.

       EAI_NONAME
              The  node  or service is not known.  This error is also returned
              if both node and service are NULL.

       EAI_SERVICE
              The requested service is not available for the requested  socket
              type.  It may be available through another socket type.

       EAI_ADDRFAMILY
              The  specified  network host does not have any network addresses
              in the requested address family.

       EAI_NODATA
              The specified network host exists, but does not have any network
              addresses defined.

       EAI_MEMORY
              Out of memory.

       EAI_FAIL
              The name server returned a permanent failure indication.

       EAI_AGAIN
              The  name  server  returned a temporary failure indication.  Try
              again later.

       EAI_SYSTEM
              Other system error, check errno for details.

       The gai_strerror(3) function translates these error codes  to  a  human
       readable string, suitable for error reporting.

SEEALSO
       getipnodebyname(3), getipnodebyaddr(3)



Linux Man Page                    2000-12-18                    getaddrinfo(3)

CMSG_ALIGNfmodllroundfstrncmp
CMSG_FIRSTHDRfnmatchllroundlstrncpy
CMSG_NXTHDRfopenlocaleconvstrndup
CMSG_SPACEforkptylocaltimestrndupa
MB_CUR_MAXfpathconflockfstrnlen
MB_LEN_MAXfprintflogstrpbrk
__fbufsizefpurgelog10strptime
__flbffputclog1pstrrchr
__fpendingfputc_unlockedlogin_ttystrsep
__fpurgefputslogwtmpstrsignal
__freadablefputs_unlockedlongjmpstrspn
__freadingfputwclrand48strstr
__fsetlockingfputwc_unlockedlrintstrtod
__fwritablefputwslrintfstrtof
__fwritingfputws_unlockedlrintlstrtok
__malloc_hookfreadlroundstrtok_r
__setfpucwfread_unlockedlroundfstrtol
_flushlbffreelroundlstrtold
a64lfreeaddrinfolsearchstrtoll
abortfreehostentmakecontextstrtoq
absfreopenmallocstrtoul
acosfrexpmalloc_hookstrtoull
acoshfscanfmblenstrtouq
addmntentfseekmbrlenstrverscmp
allocafseekombrtowcstrxfrm
alphasortfsetposmbsinitsvc_destroy
argz_addftellmbsnrtowcssvc_freeargs
argz_add_sepftellombsrtowcssvc_getargs
argz_appendftimembstowcssvc_getcaller
argz_countftokmbtowcsvc_getreq
argz_createftrylockfilememalignsvc_getreqset
argz_create_sepftsmemccpysvc_register
argz_deletefts_childrenmemchrsvc_run
argz_extractfts_closememcmpsvc_sendreply
argz_insertfts_openmemcpysvc_unregister
argz_nextfts_readmemfrobsvcerr_auth
argz_replacefts_setmemmemsvcerr_decode
argz_stringifyftwmemmovesvcerr_noproc
asctimefunlockfilememrchrsvcerr_noprog
asinfwidememsetsvcerr_progvers
asinhfwprintfmkdtempsvcerr_systemerr
asprintffwritemkfifosvcerr_weakauth
assertfwrite_unlockedmkstempsvcfd_create
assert_perrorgai_strerrormktempsvcraw_create
atangammamktimesvctcp_create
atan2gammafmodfsvcudp_bufcreate
atanhgammalmpoolsvcudp_create
atexitgcvtmrand48swab
atofget_current_dir_namemtraceswapcontext
atoiget_myaddressmuntraceswprintf
atolgetaddrinfonansysconf
atollgetcnanfsyslog
atoqgetc_unlockednanlsystem
auth_destroygetcharnearbyinttan
authnone_creategetchar_unlockednearbyintftanh
authunix_creategetcwdnearbyintltcdrain
authunix_create_defaultgetdatenetlinktcflow
basenamegetdate_rnextaftertcflush
bcmpgetdelimnextafterftcgetattr
bcopygetdirentriesnextafterltcgetpgrp
bindresvportgetenvnexttowardtcgetsid
bsearchgetfsentnexttowardftcsendbreak
bstringgetfsfilenexttowardltcsetattr
btowcgetfsspecnftwtcsetpgrp
btreegetgrentnl_langinfotdelete
byteordergetgrgidnrand48telldir
bzerogetgrnamntohltempnam
callocgethostbyaddrntohstermios
callrpcgethostbynameon_exittfind
catclosegethostbyname2opendirtgamma
catgetsgethostbyname2_ropenlogtgammaf
catopengethostbyname_ropenptytgammal
cbrtgetipnodebyaddrpathconftimegm
ceilgetipnodebynamepclosetimelocal
ceilfgetlineperrortmpfile
ceillgetloadavgpmap_getmapstmpnam
cfgetispeedgetloginpmap_getporttoascii
cfgetospeedgetmntentpmap_rmtcalltolower
cfmakerawgetnameinfopmap_settoupper
cfsetispeedgetnetbyaddrpmap_unsettowctrans
cfsetospeedgetnetbynamepopentowlower
clearenvgetnetentposix_memaligntowupper
clearerrgetoptpowtrunc
clearerr_unlockedgetopt_longprintftruncf
clnt_broadcastgetopt_long_onlyprofiltruncl
clnt_callgetpasspsignaltsearch
clnt_controlgetprotobynameptsnamettyname
clnt_creategetprotobynumberputcttyname_r
clnt_destroygetprotoentputc_unlockedttyslot
clnt_freeresgetptputchartwalk
clnt_geterrgetpwputchar_unlockedtzset
clnt_pcreateerrorgetpwentputenvulimit
clnt_perrnogetpwnamputpwentundocumented
clnt_perrorgetpwuidputsungetc
clnt_spcreateerrorgetrpcbynamepututlineungetwc
clnt_sperrnogetrpcbynumberpututxlineunlocked_stdio
clnt_sperrorgetrpcentputwunlockpt
clntraw_creategetrpcportputwcunsetenv
clnttcp_creategetsputwc_unlockedupdwtmp
clntudp_bufcreategetservbynameputwcharusleep
clntudp_creategetservbyportputwchar_unlockedutmpname
clockgetserventqecvtva_arg
closedirgetttyentqecvt_rva_end
closeloggetttynamqfcvtva_start
cmsggetumaskqfcvt_rvalloc
confstrgetusershellqgcvtvasprintf
copysigngetutentqsortvdprintf
copysignfgetutidqueueverr
copysignlgetutlineraiseverrx
cosgetutxentrandversionsort
coshgetutxidrandomvfprintf
cryptgetutxlinercmdvfscanf
ctermidgetwre_compvfwprintf
ctimegetwcre_execvprintf
cuseridgetwc_unlockedreaddirvscanf
daemongetwcharreallocvsnprintf
dbgetwchar_unlockedrealpathvsprintf
dbopengetwdrecnovsscanf
difftimeglobregcompvswprintf
dirfdglobfreeregerrorvsyslog
dirnamegmtimeregexvwarn
divgrantptregexecvwarnx
dlclosegsignalregfreevwprintf
dlerrorhashregisterrpcwarn
dlopenhasmntoptremovewarnx
dlsymhcreateremquewcpcpy
dn_comphcreate_rres_initwcpncpy
dn_expandhdestroyres_mkquerywcrtomb
dprintfhdestroy_rres_querywcscasecmp
drand48herrorres_querydomainwcscat
dremhsearchres_searchwcschr
dysizehsearch_rres_sendwcscmp
ecvthstrerrorresolverwcscpy
ecvt_rhtonlrewindwcscspn
encrypthtonsrewinddirwcsdup
endfsenthypotrindexwcslen
endgrenticonvrintwcsncasecmp
endhostenticonv_closerintfwcsncat
endmntenticonv_openrintlwcsncmp
endnetentimaxabsroundwcsncpy
endprotoentindexroundfwcsnlen
endpwentinetroundlwcsnrtombs
endrpcentinet_addrrpcwcspbrk
endserventinet_atonrresvportwcsrchr
endttyentinet_lnaofrtnetlinkwcsrtombs
endusershellinet_makeaddrruserokwcsspn
endutentinet_netofscandirwcsstr
endutxentinet_networkscanfwcstok
envz_addinet_ntoaseed48wcstombs
envz_entryinet_ntopseekdirwcswidth
envz_getinet_ptonsetbufwctob
envz_mergeinfnansetbufferwctomb
envz_removeinitgroupssetenvwctrans
envz_stripinitstatesetfsentwctype
erand48insquesetgrentwcwidth
erfintrosethostentwmemchr
erfciruseroksetjmpwmemcmp
errisalnumsetkeywmemcpy
errnoisalphasetlinebufwmemmove
errxisasciisetlocalewmemset
ether_atonisattysetlogmaskwprintf
ether_aton_risblanksetmntentxdr
ether_hosttoniscntrlsetnetentxdr_accepted_reply
ether_lineisdigitsetprotoentxdr_array
ether_ntoaisgraphsetpwentxdr_authunix_parms
ether_ntoa_risinfsetrpcentxdr_bool
ether_ntohostislowersetserventxdr_bytes
execisnansetstatexdr_callhdr
execlisprintsetttyentxdr_callmsg
execleispunctsetusershellxdr_char
execlpisspacesetutentxdr_destroy
execvisuppersetutxentxdr_double
execvpiswalnumsetvbufxdr_enum
exitiswalphashm_openxdr_float
expiswblanksigaddsetxdr_free
expm1iswcntrlsigdelsetxdr_getpos
fabsiswctypesigemptysetxdr_inline
fabsfiswdigitsigfillsetxdr_int
fabsliswgraphsiginterruptxdr_long
fcloseiswlowersigismemberxdr_opaque
fclosealliswprintsiglongjmpxdr_opaque_auth
fcvtiswpunctsignbitxdr_pmap
fcvt_riswspacesigsetjmpxdr_pmaplist
fdopeniswuppersigsetopsxdr_pointer
feclearexceptiswxdigitsinxdr_reference
fegetenvisxdigitsinhxdr_rejected_reply
fegetexceptflagj0sleepxdr_replymsg
fegetroundj0fsnprintfxdr_setpos
feholdexceptj0lsprintfxdr_short
fenvj1sqrtxdr_string
feofj1fsrandxdr_u_char
feof_unlockedj1lsrand48xdr_u_int
feraiseexceptjnsrandomxdr_u_long
ferrorjnfsscanfxdr_u_short
ferror_unlockedjnlssignalxdr_union
fesetenvjrand48stdargxdr_vector
fesetexceptflagkey_decryptsessionstderrxdr_void
fesetroundkey_encryptsessionstdinxdr_wrapstring
fetestexceptkey_gendesstdioxdrmem_create
feupdateenvkey_secretkey_is_setstdio_extxdrrec_create
fflushkey_setsecretstdoutxdrrec_endofrecord
fflush_unlockedkillpgstpcpyxdrrec_eof
ffsklogctlstpncpyxdrrec_skiprecord
fgetcl64astrcasecmpxdrstdio_create
fgetc_unlockedlabsstrcatxprt_register
fgetgrentlcong48strchrxprt_unregister
fgetposldexpstrcmpy0
fgetpwentldivstrcolly0f
fgetslfindstrcpyy0l
fgets_unlockedlgammastrcspny1
fgetwclgamma_rstrdupy1f
fgetwc_unlockedlgammafstrdupay1l
fgetwslgammaf_rstrerroryn
fgetws_unlockedlgammalstrerror_rynf
filenolgammal_rstrfmonynl
fileno_unlockedllabsstrfry 
finitelldivstrftime 
flockfilellrintstring 
floorllrintfstrlen 
floorfllrintlstrncasecmp 


Transmission 1.41 beta 2
Lightweight, yet powerful BitTorrent client
X-Moto 0.5.0
2D motocross platform game
Gdm 2.25.1
Reimplementation of the well known xdm program.
Linux Kernel 2.6 2.6.28-rc7
Linux Kernel
Linux Kernel 2.4 2.4.37
Linux Kernel
RIP 7.3
Small linux system for the purpose of system booting or repairing
GEdit 2.25.1
Small but powerful text editor
VLC media player 0.9.7
Cross-platform media player and streaming server
GNOME 2.25.2
GNOME desktop environment
WebGUI 7.6.5
A fully featured content management system.
Free IT Magazines, White Papers, eBooks, and more !
Dr. Dobb's Journal

Dr. Dobb's Journal enables programmers to write the most efficient and sophisticated programs and help in daily programming quandaries.

The 7 Things that IT Security Professionals MUST KNOW!

Gain key insight into security problem and find the safest means to protect your technological assets.

Database Trends and Applications

Provides timely coverage of the technology, intelligence and insight needed to plan, implement and manage information-rich projects.

Linux Software Map
Find Linux RPM
Best Rated Linux Software
Most Rated Linux Software
Linux Distributions
Linux Howtos
Quick Survey

Please take our survey and help us improve our website to serve you better.

Thank you.
Linux Software
Linux / IT Resources
Site Resources
Google
Privacy Policy
Contact Us
Submit Software
Advertising info