1QHostAddress(3qt)                                            QHostAddress(3qt)
2
3
4

NAME

6       QHostAddress - IP address
7

SYNOPSIS

9       #include <qhostaddress.h>
10
11   Public Members
12       QHostAddress ()
13       QHostAddress ( Q_UINT32 ip4Addr )
14       QHostAddress ( Q_UINT8 * ip6Addr )
15       QHostAddress ( const Q_IPV6ADDR & ip6Addr )
16       QHostAddress ( const QHostAddress & address )
17       virtual ~QHostAddress ()
18       QHostAddress & operator= ( const QHostAddress & address )
19       void setAddress ( Q_UINT32 ip4Addr )
20       void setAddress ( Q_UINT8 * ip6Addr )
21       bool setAddress ( const QString & address )
22       bool isIp4Addr () const  (obsolete)
23       Q_UINT32 ip4Addr () const  (obsolete)
24       bool isIPv4Address () const
25       Q_UINT32 toIPv4Address () const
26       bool isIPv6Address () const
27       Q_IPV6ADDR toIPv6Address () const
28       QString toString () const
29       bool operator== ( const QHostAddress & other ) const
30       bool isNull () const
31

DESCRIPTION

33       The QHostAddress class provides an IP address.
34
35       This class contains an IP address in a platform and protocol
36       independent manner. It stores both IPv4 and IPv6 addresses in a way
37       that you can easily access on any platform.
38
39       QHostAddress is normally used with the classes QSocket, QServerSocket
40       and QSocketDevice to set up a server or to connect to a host.
41
42       Host addresses may be set with setAddress() and retrieved with
43       ip4Addr() or toString().
44
45       See also QSocket, QServerSocket, QSocketDevice, and Input/Output and
46       Networking.
47

MEMBER FUNCTION DOCUMENTATION

QHostAddress::QHostAddress ()

50       Creates a host address object with the IP address 0.0.0.0.
51

QHostAddress::QHostAddress ( Q_UINT32 ip4Addr )

53       Creates a host address object for the IPv4 address ip4Addr.
54

QHostAddress::QHostAddress ( Q_UINT8 * ip6Addr )

56       Creates a host address object with the specified IPv6 address.
57
58       ip6Addr must be a 16 byte array in network byte order (high-order byte
59       first).
60

QHostAddress::QHostAddress ( const Q_IPV6ADDR & ip6Addr )

62       Creates a host address object with the IPv6 address, ip6Addr.
63

QHostAddress::QHostAddress ( const QHostAddress & address )

65       Creates a copy of address.
66

QHostAddress::~QHostAddress () [virtual]

68       Destroys the host address object.
69

Q_UINT32 QHostAddress::ip4Addr () const

71       This function is obsolete. It is provided to keep old source working.
72       We strongly advise against using it in new code.
73
74       Use toIPv4Address() instead.
75

bool QHostAddress::isIPv4Address () const

77       Returns TRUE if the host address represents an IPv4 address; otherwise
78       returns FALSE.
79

bool QHostAddress::isIPv6Address () const

81       Returns TRUE if the host address represents an IPv6 address; otherwise
82       returns FALSE.
83

bool QHostAddress::isIp4Addr () const

85       This function is obsolete. It is provided to keep old source working.
86       We strongly advise against using it in new code.
87
88       Use isIPv4Address() instead.
89

bool QHostAddress::isNull () const

91       Returns TRUE if this host address is null (INADDR_ANY or in6addr_any).
92       The default constructor creates a null address, and that address isn't
93       valid for any particular host or interface.
94

QHostAddress & QHostAddress::operator= ( const QHostAddress & address )

96       Assigns another host address object address to this object and returns
97       a reference to this object.
98

bool QHostAddress::operator== ( const QHostAddress & other ) const

100       Returns TRUE if this host address is the same as other; otherwise
101       returns FALSE.
102

void QHostAddress::setAddress ( Q_UINT32 ip4Addr )

104       Set the IPv4 address specified by ip4Addr.
105

void QHostAddress::setAddress ( Q_UINT8 * ip6Addr )

107       This is an overloaded member function, provided for convenience. It
108       behaves essentially like the above function.
109
110       Set the IPv6 address specified by ip6Addr.
111
112       ip6Addr must be a 16 byte array in network byte order (high-order byte
113       first).
114

bool QHostAddress::setAddress ( const QString & address )

116       This is an overloaded member function, provided for convenience. It
117       behaves essentially like the above function.
118
119       Sets the IPv4 or IPv6 address specified by the string representation
120       address (e.g. "127.0.0.1"). Returns TRUE and sets the address if the
121       address was successfully parsed; otherwise returns FALSE and leaves the
122       address unchanged.
123

Q_UINT32 QHostAddress::toIPv4Address () const

125       Returns the IPv4 address as a number.
126
127       For example, if the address is 127.0.0.1, the returned value is
128       2130706433 (i.e. 0x7f000001).
129
130       This value is only valid when isIp4Addr() returns TRUE.
131
132       See also toString().
133

Q_IPV6ADDR QHostAddress::toIPv6Address () const

135       Returns the IPv6 address as a Q_IPV6ADDR structure. The structure
136       consists of 16 unsigned characters.
137
138               Q_IPV6ADDR addr = hostAddr.ip6Addr();
139               // addr.c[] contains 16 unsigned characters
140               for (int i = 0; i < 16; ++i) {
141                   // process addr.c[i]
142               }
143
144       This value is only valid when isIPv6Address() returns TRUE.
145
146       See also toString().
147

QString QHostAddress::toString () const

149       Returns the address as a string.
150
151       For example, if the address is the IPv4 address 127.0.0.1, the returned
152       string is "127.0.0.1".
153
154       See also ip4Addr().
155
156

SEE ALSO

158       http://doc.trolltech.com/qhostaddress.html
159       http://www.trolltech.com/faq/tech.html
160
162       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
163       license file included in the distribution for a complete license
164       statement.
165

AUTHOR

167       Generated automatically from the source code.
168

BUGS

170       If you find a bug in Qt, please report it as described in
171       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
172       help you. Thank you.
173
174       The definitive Qt documentation is provided in HTML format; it is
175       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
176       web browser. This man page is provided as a convenience for those users
177       who prefer man pages, although this format is not officially supported
178       by Trolltech.
179
180       If you find errors in this manual page, please report them to qt-
181       bugs@trolltech.com.  Please include the name of the manual page
182       (qhostaddress.3qt) and the Qt version (3.3.8).
183
184
185
186Trolltech AS                    2 February 2007              QHostAddress(3qt)
Impressum