Network library

From KolibriOS wiki
Revision as of 19:27, 24 February 2015 by Hidnplayr (talk | contribs) (Created page with "=Network Library= ==inet_addr== '''Convert the string from standard IPv4 dotted notation to integer IP addr.'''<br> Input: ptr to ASCIIZ string containing standard dotted IPv4...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Network Library

inet_addr

Convert the string from standard IPv4 dotted notation to integer IP addr.
Input: ptr to ASCIIZ string containing standard dotted IPv4 address.
Output: eax = converted IP address / -1 on error

Example:

; Code section:
invoke inet_addr ip_address
; eax should now be 0X0100A8C0

; Data section:
ip_address db '192.168.0.1', 0

inet_ntoa

Convert the Internet host address to standard IPv4 dotted notation.
Input: in_addr struct
Output: eax = pointer to resulting string (in static buffer)

Example:

getaddrinfo

Get a list of IP addresses and port numbers for given host and service
Input:

  • ptr to hostname (optional)
  • ptr to servname (optional)
  • ptr to addrinfo struct hints (optional)
  • ptr to result addrinfo struct

Output: eax = 0 on success / one of EAI codes on error

Example:

freeaddrinfo

Free one or more addrinfo structures returned by getaddrinfo.
Input: ptr to addrinfo struct
Output: /

Example: