class KInetSocketAddress

an Internet socket address. More...

Definition#include <ksockaddr.h>
InheritsKSocketAddress
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods


Detailed Description

An Inet (IPv4 or IPv6) socket address

This is an IPv4 or IPv6 address of the Internet

This class inherits most of the functionality from KSocketAddress, but is targeted specifically to Internet addresses

 KInetSocketAddress ()

Default constructor. Does nothing

 KInetSocketAddress (const sockaddr_in* sin, ksocklen_t len)

Creates an IPv4 socket from raw sockaddr_in

Parameters:
sina sockaddr_in structure to copy from

 KInetSocketAddress (const sockaddr_in6* sin6, ksocklen_t len)

Creates an IPv6 socket from raw sockaddr_in6

Parameters:
sin6a sockaddr_in6 structure to copy from

 KInetSocketAddress (const in_addr& addr, unsigned short port)

Creates a socket from information

Parameters:
addra binary address
porta port number

 KInetSocketAddress (const in6_addr& addr, unsigned short port)

Creates a socket from information

Parameters:
addra binary address
porta port number

 KInetSocketAddress (const QString& addr, unsigned short port, int family = -1)

Creates a socket from text representation

Parameters:
addra text representation of the address
porta port number

KInetSocketAddress ()

[virtual]

Destructor

bool  setAddress (const sockaddr_in* sin, ksocklen_t len)

Sets this socket to given raw socket

Parameters:
sinthe raw socket

bool  setAddress (const sockaddr_in6* sin6, ksocklen_t len)

Sets this socket to given raw socket

Parameters:
sin6the raw socket

bool  setAddress (const in_addr& addr, unsigned short port)

Sets this socket to raw address and port

Parameters:
addrthe address
portthe port number

bool  setAddress (const in6_addr& addr, unsigned short port)

Sets this socket to raw address and port

Parameters:
addrthe address
portthe port number

bool  setAddress (const QString& addr, unsigned short port, int family = -1)

Sets this socket to text address and port

Parameters:
addrthe address
portthe port number
familythe address family, -1 for any

bool  setHost (const in_addr& addr)

Sets this socket's host address to given raw address

Parameters:
addrthe address

bool  setHost (const in6_addr& addr)

Sets this socket's host address to given raw address

Parameters:
addrthe address

bool  setHost (const QString& addr, int family = -1)

Sets this socket's host address to given text representation

Parameters:
addrthe address
familythe address family, -1 for any

bool  setPort (unsigned short port)

Sets this socket's port number to given port number

Parameters:
portthe port number

bool  setFamily (int family)

Turns this into an IPv4 or IPv6 address returns 0 if this is v6 and information was lost

bool  setFlowinfo (Q_UINT32 flowinfo)

Sets flowinfo information for this socket address if this is IPv6

Parameters:
flowinfoflowinfo

bool  setScopeId (int scopeid)

Sets the scope id for this socket if this is IPv6

Parameters:
scopeidthe scope id

QString  pretty ()

[const virtual]

Returns a pretty representation of this address

Reimplemented from KSocketAddress

QString  prettyHost ()

[const]

Returns the text representation of the host address

const sockaddr_in*  addressV4 ()

[const]

Returns the socket address This will be NULL if this is a non-convertible v6

const sockaddr_in6*  addressV6 ()

[const]

Returns the socket address in IPv6

in_addr  hostV4 ()

[const]

Returns the host address Might be empty

in6_addr  hostV6 ()

[const]

Returns the host address WARNING: this function is not defined if there is no IPv6 support

unsigned short  port ()

[const]

Returns the port number

int  family ()

[const]

Returns the socket family

Reimplemented from KSocketAddress

Q_UINT32  flowinfo ()

[const]

Returns flowinfo for IPv6 socket

int  scopeId ()

[const]

Returns the scope id for this IPv6 socket

ksocklen_t  size ()

[const virtual]

Returns the socket length Will be either sizeof(sockaddr_in) or sizeof(sockaddr_in6)

Reimplemented from KSocketAddress

bool  isCoreEqual (const KSocketAddress& other)

[const virtual]

This kind of socket supports core comparation. This will compare the IP part of the sockets only.

Parameters:
otherthe other socket

Reimplemented from KSocketAddress

 operator const sockaddr_in* ()

[const]

Returns the socket address This will be NULL if this is a non-convertible v6