Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

inet_ntop(3) [php man page]

INET_NTOP(3)								 1							      INET_NTOP(3)

inet_ntop - Converts a packed internet address to a human readable representation

SYNOPSIS
string inet_ntop (string $in_addr) DESCRIPTION
This function converts a 32bit IPv4, or 128bit IPv6 address (if PHP was built with IPv6 support enabled) into an address family appropri- ate string representation. PARAMETERS
o $in_addr - A 32bit IPv4, or 128bit IPv6 address. RETURN VALUES
Returns a string representation of the address or FALSE on failure. EXAMPLES
Example #1 inet_ntop(3) Example <?php $packed = chr(127) . chr(0) . chr(0) . chr(1); $expanded = inet_ntop($packed); /* Outputs: 127.0.0.1 */ echo $expanded; $packed = str_repeat(chr(0), 15) . chr(1); $expanded = inet_ntop($packed); /* Outputs: ::1 */ echo $expanded; ?> CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | This function is now available on Windows plat- | | | forms. | | | | +--------+---------------------------------------------------+ SEE ALSO
long2ip(3), ip2long(3), inet_pton(3). PHP Documentation Group INET_NTOP(3)

Check Out this Related Man Page

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

NAME
inet_ntop - convert IPv4 and IPv6 addresses from binary to text form SYNOPSIS
#include <arpa/inet.h> const char *inet_ntop(int af, const void *src, char *dst, socklen_t size); DESCRIPTION
This function converts the network address structure src in the af address family into a character string. The resulting string is copied to the buffer pointed to by dst, which must be a non-NULL pointer. The caller specifies the number of bytes available in this buffer in the argument size. inet_ntop() extends the inet_ntoa(3) function to support multiple address families, inet_ntoa(3) is now considered to be deprecated in favor of inet_ntop(). The following address families are currently supported: AF_INET src points to a struct in_addr (in network byte order) which is converted to an IPv4 network address in the dotted-decimal format, "ddd.ddd.ddd.ddd". The buffer dst must be at least INET_ADDRSTRLEN bytes long. AF_INET6 src points to a struct in6_addr (in network byte order) which is converted to a representation of this address in the most appropri- ate IPv6 network address format for this address. The buffer dst must be at least INET6_ADDRSTRLEN bytes long. RETURN VALUE
On success, inet_ntop() returns a non-NULL pointer to dst. NULL is returned if there was an error, with errno set to indicate the error. ERRORS
EAFNOSUPPORT af was not a valid address family. ENOSPC The converted address string would exceed the size given by size. CONFORMING TO
POSIX.1-2001. Note that RFC 2553 defines a prototype where the last argument size is of type size_t. Many systems follow RFC 2553. Glibc 2.0 and 2.1 have size_t, but 2.2 and later have socklen_t. BUGS
AF_INET6 converts IPv4-mapped IPv6 addresses into an IPv6 format. EXAMPLE
See inet_pton(3). SEE ALSO
getnameinfo(3), inet(3), inet_pton(3) COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2008-11-11 INET_NTOP(3)
Man Page

8 More Discussions You Might Find Interesting

1. Programming

while ..until

how do u say this : decrement the pointer chr untill you find chr == ' ' OR chr == '<' (4 Replies)
Discussion started by: Beginner2002
4 Replies

2. Shell Programming and Scripting

[PHP] IPv6 lookup in prefix function

Hi there, Was wondering if you could help me out again. In my efforts to write a function to check whether an IPv6 address is part of an IPv6 prefix, I've come up with this: function isIPIn ($ip,$net,$mask) { $net = pack("H" . strlen($net), str_replace(":", "", $net)); $ip... (0 Replies)
Discussion started by: zheng
0 Replies

3. Shell Programming and Scripting

Merging fields --- Help me plz

INPUT have a file with 2 columns. evry set in a column ends with a symbol //. the first one with something like chr, chr no, chromosome name, cell no. cell no. etc and the second column has values belong to the first columnlike chr Xy, 22, 345,22222 etc. Some clumns have repeated but not... (4 Replies)
Discussion started by: bogu0001
4 Replies

4. Shell Programming and Scripting

Problem while concating PIPE symbol with a file

Hi Gurus, I had a problem writing a pipe file. Previously i used this code to generate a tab seperated file ABCEF := ABCEF || 'to_char('|| abc_tab(col_num).col_name || ') chr(9) || '; Now i want the o/p as pipe seperated file.I changed the line as below ABCEF := ABCEF ||... (0 Replies)
Discussion started by: pssandeep
0 Replies

5. UNIX for Dummies Questions & Answers

how to removed chr(10) characters in a file

Hi, How do we remove an extra new line in a file. New line in ascii is called chr(10). Suppose we have a file as: 12345 98765 ------ ------ From the above i represented new line with dashed lines. Basically i have 2 new lines with white space at the end of the file. How do i removes... (1 Reply)
Discussion started by: sandeep_1105
1 Replies

6. Programming

IPv4 string->int

Does anyone know how to convert a IP address given as 'string' into a 'u_int32_t'? Are there any build any functions already? (1 Reply)
Discussion started by: Freaky123
1 Replies

7. Programming

getting error in my perl script

hi Here is my code written to identify the particular position which is after a string (chr*). my input file looks some thing like this aaanbb:anhn:iuopl:12345 chr1 12345 asnmkol * # kjiiii.....anmkij:lpolk:lopll:abnnj chr5 123222 polko * dddfgg .... aaanbb:anhn:iuopl:aanjuj chr2 44345 asnmkol... (1 Reply)
Discussion started by: anurupa777
1 Replies

8. Shell Programming and Scripting

Awk: syntax error

awk -F, ' NR>1 { BEGIN{ chr=$2 } END{ for (k in chr) {print k} } } ' $gene_file I've a really simple code. I want to store gene name and it's chromosome and in the end print them. I'm skipping line one as it contains headers. But I don't know why I get error as: (2 Replies)
Discussion started by: genome
2 Replies