---
name: "qsocketaddress"
section: "3qt"
platform: "linux"
package: "libqt2-dev"
version: "1:2.0.2-1.1"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/qsocketaddress"
---

# qsocketaddress(3qt)

QSocketAddress provides a port number and an IP address

## NAME

QSocketAddress - QSocketAddress provides a port number and an IP address

## SYNOPSIS

`#include <qsocketdevice.h>`

### Public Members

**QSocketAddress ()**\
 **QSocketAddress ( int** *port***, uint** *ip4Addr***=0 )**\
 **QSocketAddress ( const QSocketAddress & )**\
 **~QSocketAddress ()**\
 **QSocketAddress& operator= ( const QSocketAddress & )**\
 **int port () const**\
 **uint ip4Addr () const**\
 **QString ip4AddrString () const**\
 **bool operator== ( const QSocketAddress & )**\

### Protected Members

**void\* data () const**\
 **int length () const**\
 **void setData ( void \*, int )**\

## DESCRIPTION

QSocketAddress provides a port number and an IP address.

This class contains a port number and an IP address in a platform-independent manner. QSocketAddress is normally used with the classes QSocketDevice and QSocket to set up a server or to connect to a host.

See also: QSocket and QSocketDevice.

## MEMBER FUNCTION DOCUMENTATION

## QSocketAddress::QSocketAddress ()

Creates a socket address object with the port number 0 and IP address 0.0.0.0.

## QSocketAddress::QSocketAddress ( const QSocketAddress & a )

Creates a copy of another socket address.

## QSocketAddress::QSocketAddress ( int port, uint ip4Addr=0 )

Creates a socket address object with a specified port number and IP address.

## QSocketAddress::~QSocketAddress ()

Destroys the socket address object.

## uint QSocketAddress::ip4Addr () const

Returns the IP address as a number.

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

See also: ip4AddrString().

## QString QSocketAddress::ip4AddrString () const

Returns the IP address as a string.

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

See also: ip4Addr().

## QSocketAddress & QSocketAddress::operator= ( const QSocketAddress & a )

Assigns another socket address object *a* to this object and returns a referense to this object.

## bool QSocketAddress::operator== ( const QSocketAddress & a )

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

## int QSocketAddress::port () const

Returns the port number.

## SEE ALSO

**http://www.troll.no/qt/qsocketaddress.html**

## COPYRIGHT

Copyright 1992-1999 Troll Tech AS.  See the license file included in the distribution for a complete license statement.

## AUTHOR

Generated automatically from the source code.
