KNetwork::KInetSocketAddress
#include <k3socketaddress.h>

Protected Member Functions | |
KInetSocketAddress (KSocketAddressData *d) | |
![]() | |
KSocketAddress (KSocketAddressData *d) | |
Additional Inherited Members | |
![]() | |
static int | fromIanaFamily (int iana) |
static int | ianaFamily (int af) |
![]() | |
KSocketAddressData * | d |
Detailed Description
an Internet socket address
An Inet (IPv4 or IPv6) socket address
This is an IPv4 or IPv6 address of the Internet.
- Deprecated:
- Use KSocketFactory or KLocalSocket instead
Definition at line 704 of file k3socketaddress.h.
Constructor & Destructor Documentation
◆ KInetSocketAddress() [1/6]
KInetSocketAddress::KInetSocketAddress | ( | ) |
◆ KInetSocketAddress() [2/6]
KInetSocketAddress::KInetSocketAddress | ( | const sockaddr * | sa, |
quint16 | len | ||
) |
Creates an object from raw data.
Note: if the socket address sa
does not contain a valid Internet socket (IPv4 or IPv6), this object will be empty.
- Parameters
-
sa the sockaddr structure len the structure's length
Definition at line 694 of file k3socketaddress.cpp.
◆ KInetSocketAddress() [3/6]
KInetSocketAddress::KInetSocketAddress | ( | const KIpAddress & | host, |
quint16 | port | ||
) |
Creates an object from an IP address and port.
- Parameters
-
host the IP address port the port number
Definition at line 703 of file k3socketaddress.cpp.
◆ KInetSocketAddress() [4/6]
KInetSocketAddress::KInetSocketAddress | ( | const KInetSocketAddress & | other | ) |
Copy constructor.
Data is not shared.
- Parameters
-
other the other object
Definition at line 710 of file k3socketaddress.cpp.
◆ KInetSocketAddress() [5/6]
KInetSocketAddress::KInetSocketAddress | ( | const KSocketAddress & | other | ) |
Copy constructor.
If the other, generic socket address contains an Internet address, it will be copied. Otherwise, this object will be empty.
- Parameters
-
other the other object
Definition at line 716 of file k3socketaddress.cpp.
◆ ~KInetSocketAddress()
|
override |
Destroys this object.
Definition at line 731 of file k3socketaddress.cpp.
◆ KInetSocketAddress() [6/6]
|
protected |
extra constructor
Definition at line 725 of file k3socketaddress.cpp.
Member Function Documentation
◆ flowinfo()
quint32 KInetSocketAddress::flowinfo | ( | ) | const |
Returns the flowinfo information from the IPv6 socket address.
- Returns
- the flowinfo information or 0 if this object is empty or IPv4
Definition at line 858 of file k3socketaddress.cpp.
◆ ipAddress()
KIpAddress KInetSocketAddress::ipAddress | ( | ) | const |
Returns the IP address component.
Definition at line 763 of file k3socketaddress.cpp.
◆ ipVersion()
int KInetSocketAddress::ipVersion | ( | ) | const |
Returns the IP version of the address this object holds.
- Returns
- 4 or 6, if IPv4 or IPv6, respectively; 0 if this object is empty
Definition at line 744 of file k3socketaddress.cpp.
◆ makeIPv4()
KInetSocketAddress & KInetSocketAddress::makeIPv4 | ( | ) |
Converts this object to an IPv4 socket address.
It has no effect if the object is already an IPv4 socket address.
If this object is an IPv6 address, the port number is preserved. All other information is lost.
- Returns
- a reference to itself
Definition at line 846 of file k3socketaddress.cpp.
◆ makeIPv6()
KInetSocketAddress & KInetSocketAddress::makeIPv6 | ( | ) |
Converts this object to an IPv6 socket address.
It has no effect if the object is already an IPv6 socket address.
If this object is an IPv4 address, the port number is preserved.
- Returns
- a reference to itself
Definition at line 852 of file k3socketaddress.cpp.
◆ operator const sockaddr_in *()
|
inline |
Cast operator to sockaddr_in.
Definition at line 768 of file k3socketaddress.h.
◆ operator const sockaddr_in6 *()
|
inline |
Cast operator to sockaddr_in6.
Definition at line 776 of file k3socketaddress.h.
◆ operator=()
KInetSocketAddress & KInetSocketAddress::operator= | ( | const KInetSocketAddress & | other | ) |
Copy operator.
Copies the other object into this one.
- Parameters
-
other the other object
Definition at line 737 of file k3socketaddress.cpp.
◆ port()
quint16 KInetSocketAddress::port | ( | ) | const |
Retrieves the port number stored in this object.
- Returns
- a port number in the range 0 to 65535, inclusive. An empty or invalid object will have a port number of 0.
Definition at line 803 of file k3socketaddress.cpp.
◆ scopeId()
int KInetSocketAddress::scopeId | ( | ) | const |
Returns the scope id this IPv6 socket is bound to.
- Returns
- the scope id, or 0 if this is not an IPv6 object
Definition at line 878 of file k3socketaddress.cpp.
◆ setFlowinfo()
KInetSocketAddress & KInetSocketAddress::setFlowinfo | ( | quint32 | flowinfo | ) |
Sets the flowinfo information for an IPv6 socket address.
If this is not an IPv6 socket address, this function converts it to one. See makeIPv6.
- Parameters
-
flowinfo the flowinfo to set
- Returns
- a reference to itself
Definition at line 871 of file k3socketaddress.cpp.
◆ setHost()
KInetSocketAddress & KInetSocketAddress::setHost | ( | const KIpAddress & | addr | ) |
Sets the IP address to the given raw address.
This call will preserve port numbers across IP versions, but will lose IPv6 specific data if the address is set to IPv4.
- Parameters
-
addr the address to set to
- Returns
- a reference to itself
Definition at line 781 of file k3socketaddress.cpp.
◆ setPort()
KInetSocketAddress & KInetSocketAddress::setPort | ( | quint16 | port | ) |
Sets the port number.
If this object is empty, this function will default to creating an IPv4 address.
- Parameters
-
port the port number to set
- Returns
- a reference to itself
Definition at line 822 of file k3socketaddress.cpp.
◆ setScopeId()
KInetSocketAddress & KInetSocketAddress::setScopeId | ( | int | scopeid | ) |
Sets the scope id for this IPv6 object.
If this is not an IPv6 socket address, this function converts it to one. See makeIPv6
- Parameters
-
scopeid the scopeid to set
- Returns
- a reference to itself
Definition at line 891 of file k3socketaddress.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:56:02 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.