QHostAddress

The QHostAddress class provides an IP address.

This class holds an IPv4 or IPv6 address in a platform- and protocol-independent manner.

QHostAddress is normally used with the QTcpSocket, QTcpServer, and QUdpSocket to connect to a host or to set up a server.

A host address is set with setAddress(), and retrieved with toIPv4Address(), toIPv6Address(), or toString(). You can check the type with protocol().

QHostAddress类提供一个IP地址。

这个类提供一个IPv4或者IPv6的地址,以一个平台和协议独立的方式。

这个类通常和QTcpSocket,QTcpServer,QudpSocket一起使用,是为了链接一个主机或者为了建立一个服务器。

一个主机地址是通过setAddress()设定的,并通过toIPv4Address(),toIPv6Address(),或者toString()找回的。你可以用protocol()来判断它的类型。

posted @ 2020-05-23 16:33  郭朋振  阅读(723)  评论(0编辑  收藏  举报