Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Classes  ·  Annotées  ·  Hiérarchie  ·  Fonctions  ·  Structure  · 

QHostAddress Class Reference
[ network module ]


The QHostAddress class provides an IP address. More...

#include <qhostaddress.h>

List of all member functions.

Public Members


Detailed Description

The QHostAddress class provides an IP address.

This class contains an IP address in a platform- and protocol-independent manner. That is, it'll store the address in a way you can access easily on any platform, and it'll store both IPv4 and IPv6 addresses.

QHostAddress is normally used with the classes QSocket, QServerSocket and QSocketDevice to set up a server or to connect to a host.

See also QSocket, QServerSocket and QSocketDevice.


Member Function Documentation

QHostAddress::QHostAddress ()

Creates a socket address object with the IP address 0.0.0.0.

QHostAddress::QHostAddress ( Q_UINT32 ip4Addr )

Creates a socket address object with a specified IPv4 address.

QHostAddress::QHostAddress ( Q_UINT8 * ip6Addr )

Creates a socket address object with a specified IPv6 address.

ip6Addr must be a 16 byte array in network byte order (high-order byte first).

QHostAddress::QHostAddress ( const QHostAddress & address )

Creates a copy of address.

QHostAddress::~QHostAddress () [virtual]

Destructs the socket address object.

Q_UINT32 QHostAddress::ip4Addr () const

Returns the IPv4 address as a number.

For example, if the address is 127.0.0.1, the returned value is 2130706433 (hex: 7f000001).

This value is only valid when isIp4Addr() returns TRUE.

See also toString().

bool QHostAddress::isIp4Addr () const

Return true if the host address represents a IPv4 address.

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

Assigns another socket address object address to this object and returns a reference to this object.

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

Returns TRUE if this socket address is identical to other, or FALSE if they are different.

bool QHostAddress::setAddress ( const QString & address )

Sets the IPv4 or IPv6 address specified by the string representation address (e.g. "127.0.0.1").

If this function is not able to parse the address it will return FALSE and the address is not changed.

void QHostAddress::setAddress ( Q_UINT32 ip4Addr )

Set a IPv4 address specified by ip4Addr.

void QHostAddress::setAddress ( Q_UINT8 * ip6Addr )

Set a IPv6 address specified by ip6Addr.

ip6Addr must be a 16 byte array in network byte order (high-order byte first).

QString QHostAddress::toString () const

Returns the address as a string.

For example, if the address is the IPv4 address 127.0.0.1, the returned string is "127.0.0.1".

See also ip4Addr().


Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):


This file is part of the Qt toolkit, copyright © 1995-2005 Trolltech, all rights reserved.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 2.3
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web