• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • KNetwork
  • KDatagramPacket
Public Member Functions | List of all members
KNetwork::KDatagramPacket Class Reference

#include <k3datagramsocket.h>

Public Member Functions

 KDatagramPacket ()
 
 KDatagramPacket (const char *content, uint length)
 
 KDatagramPacket (const char *content, uint length, const KSocketAddress &addr)
 
 KDatagramPacket (const KDatagramPacket &other)
 
 KDatagramPacket (const QByteArray &content)
 
 KDatagramPacket (const QByteArray &content, const KSocketAddress &addr)
 
 ~KDatagramPacket ()
 
const KSocketAddress & address () const
 
const QByteArray & data () const
 
void detach ()
 
bool isEmpty () const
 
bool isNull () const
 
uint length () const
 
void setAddress (const KSocketAddress &addr)
 
void setData (const char *data, uint length)
 
void setData (const QByteArray &data)
 
uint size () const
 

Detailed Description

one datagram

This object represents one datagram of data sent or received through a datagram socket (as KDatagramSocket or derived classes). A datagram consists of data as well as a network address associated (whither to send the data or whence it came).

This is a lightweight class. Data is stored in a QByteArray, which means that it is explicitly shared.

Author
Thiago Macieira thiag.nosp@m.o@kd.nosp@m.e.org
Deprecated:
Use KSocketFactory or KLocalSocket instead

Definition at line 52 of file k3datagramsocket.h.

Constructor & Destructor Documentation

◆ KDatagramPacket() [1/6]

KNetwork::KDatagramPacket::KDatagramPacket ( )
inline

Default constructor.

Definition at line 61 of file k3datagramsocket.h.

◆ KDatagramPacket() [2/6]

KNetwork::KDatagramPacket::KDatagramPacket ( const QByteArray &  content)
inlineexplicit

Constructs the datagram with the specified content.

Definition at line 67 of file k3datagramsocket.h.

◆ KDatagramPacket() [3/6]

KNetwork::KDatagramPacket::KDatagramPacket ( const char *  content,
uint  length 
)
inline

Constructs the datagram with the specified content.

See also
setData for information on data sharing.

Definition at line 76 of file k3datagramsocket.h.

◆ KDatagramPacket() [4/6]

KNetwork::KDatagramPacket::KDatagramPacket ( const QByteArray &  content,
const KSocketAddress &  addr 
)
inline

Constructs the datagram with the specified content and address.

Definition at line 82 of file k3datagramsocket.h.

◆ KDatagramPacket() [5/6]

KNetwork::KDatagramPacket::KDatagramPacket ( const char *  content,
uint  length,
const KSocketAddress &  addr 
)
inline

Constructs the datagram with the specified content and address.

Definition at line 89 of file k3datagramsocket.h.

◆ KDatagramPacket() [6/6]

KNetwork::KDatagramPacket::KDatagramPacket ( const KDatagramPacket &  other)
inline

Copy constructor.

Note that data is explicitly shared.

Definition at line 96 of file k3datagramsocket.h.

◆ ~KDatagramPacket()

KNetwork::KDatagramPacket::~KDatagramPacket ( )
inline

Destructor.

Non-virtual.

Definition at line 102 of file k3datagramsocket.h.

Member Function Documentation

◆ address()

const KSocketAddress & KNetwork::KDatagramPacket::address ( ) const
inline

Returns the socket address.

Definition at line 138 of file k3datagramsocket.h.

◆ data()

const QByteArray & KNetwork::KDatagramPacket::data ( ) const
inline

Returns the data.

Definition at line 108 of file k3datagramsocket.h.

◆ detach()

void KNetwork::KDatagramPacket::detach ( )
inline

Detaches our data from a shared pool.

See also
QByteArray::detach

Definition at line 151 of file k3datagramsocket.h.

◆ isEmpty()

bool KNetwork::KDatagramPacket::isEmpty ( ) const
inline

Returns true if this object is empty.

Definition at line 126 of file k3datagramsocket.h.

◆ isNull()

bool KNetwork::KDatagramPacket::isNull ( ) const
inline

Returns true if this object is null.

Definition at line 132 of file k3datagramsocket.h.

◆ length()

uint KNetwork::KDatagramPacket::length ( ) const
inline

Returns the data length.

Definition at line 114 of file k3datagramsocket.h.

◆ setAddress()

void KNetwork::KDatagramPacket::setAddress ( const KSocketAddress &  addr)
inline

Sets the address stored to the given value.

Definition at line 144 of file k3datagramsocket.h.

◆ setData() [1/2]

void KNetwork::KDatagramPacket::setData ( const char *  data,
uint  length 
)
inline

Sets the data to the given buffer and size.

Definition at line 163 of file k3datagramsocket.h.

◆ setData() [2/2]

void KNetwork::KDatagramPacket::setData ( const QByteArray &  data)
inline

Sets the data to the given value.

Data is explicitly shared.

Definition at line 157 of file k3datagramsocket.h.

◆ size()

uint KNetwork::KDatagramPacket::size ( ) const
inline

Returns the data length.

Definition at line 120 of file k3datagramsocket.h.


The documentation for this class was generated from the following file:
  • k3datagramsocket.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal