KNetwork::KSocketDevice

Search for usage in LXR

#include <k3socketdevice.h>

Inheritance diagram for KNetwork::KSocketDevice:

Public Types

enum  Capabilities {
  CanConnectString = 0x01, CanBindString = 0x02, CanNotBind = 0x04, CanNotListen = 0x08,
  CanMulticast = 0x10, CanNotUseDatagrams = 0x20
}
 
- Public Types inherited from QIODevice
enum  OpenModeFlag
 
- Public Types inherited from KNetwork::KSocketBase
enum  SocketError {
  NoError = 0, LookupFailure, AddressInUse, AlreadyCreated,
  AlreadyBound, AlreadyConnected, NotConnected, NotBound,
  NotCreated, WouldBlock, ConnectionRefused, ConnectionTimedOut,
  InProgress, NetFailure, NotSupported, Timeout,
  UnknownError, RemotelyDisconnected
}
 
enum  SocketOptions {
  Blocking = 0x01, AddressReuseable = 0x02, IPv6Only = 0x04, Keepalive = 0x08,
  Broadcast = 0x10, NoDelay = 0x20
}
 

Public Member Functions

 KSocketDevice (const KSocketBase *=nullptr, QObject *objparent=nullptr)
 
 KSocketDevice (int fd, OpenMode mode=ReadWrite)
 
 KSocketDevice (QObject *parent)
 
 ~KSocketDevice () override
 
KSocketDeviceaccept () override
 
bool bind (const KResolverEntry &address) override
 
qint64 bytesAvailable () const override
 
virtual int capabilities () const
 
void close () override
 
bool connect (const KResolverEntry &address, OpenMode mode=ReadWrite) override
 
bool create (const KResolverEntry &address)
 
virtual bool create (int family, int type, int protocol)
 
bool disconnect () override
 
QSocketNotifierexceptionNotifier () const
 
KSocketAddress externalAddress () const override
 
virtual bool flush ()
 
bool listen (int backlog=5) override
 
KSocketAddress localAddress () const override
 
qint64 peekData (char *data, qint64 maxlen, KSocketAddress *from=nullptr) override
 
KSocketAddress peerAddress () const override
 
virtual bool poll (bool *input, bool *output, bool *exception=nullptr, int timeout=-1, bool *timedout=nullptr)
 
bool poll (int timeout=-1, bool *timedout=nullptr)
 
qint64 readData (char *data, qint64 maxlen, KSocketAddress *from=nullptr) override
 
QSocketNotifierreadNotifier () const
 
bool setSocketOptions (int opts) override
 
int socket () const
 
qint64 waitForMore (int msecs, bool *timeout=nullptr) override
 
qint64 writeData (const char *data, qint64 len, const KSocketAddress *to=nullptr) override
 
QSocketNotifierwriteNotifier () const
 
- Public Member Functions inherited from KNetwork::KActiveSocketBase
 KActiveSocketBase (QObject *parent)
 
 ~KActiveSocketBase () override
 
bool atEnd () const override
 
QString errorString () const
 
bool isSequential () const override
 
bool open (OpenMode mode) override
 
qint64 peek (char *data, qint64 maxlen)
 
qint64 peek (char *data, qint64 maxlen, KSocketAddress &from)
 
qint64 pos () const override
 
qint64 read (char *data, qint64 maxlen)
 
qint64 read (char *data, qint64 maxlen, KSocketAddress &from)
 
QByteArray read (qint64 len)
 
bool seek (qint64) override
 
void setSocketDevice (KSocketDevice *device) override
 
qint64 size () const override
 
void ungetChar (char)
 
qint64 write (const char *data, qint64 len)
 
qint64 write (const char *data, qint64 len, const KSocketAddress &to)
 
qint64 write (const QByteArray &data)
 
- Public Member Functions inherited from QIODevice
 QIODevice (QObject *parent)
 
void aboutToClose ()
 
virtual qint64 bytesToWrite () const const
 
void bytesWritten (qint64 bytes)
 
virtual bool canReadLine () const const
 
void channelBytesWritten (int channel, qint64 bytes)
 
void channelReadyRead (int channel)
 
void commitTransaction ()
 
int currentReadChannel () const const
 
int currentWriteChannel () const const
 
QString errorString () const const
 
bool getChar (char *c)
 
bool isOpen () const const
 
bool isReadable () const const
 
bool isTextModeEnabled () const const
 
bool isTransactionStarted () const const
 
bool isWritable () const const
 
virtual bool open (QIODevice::OpenMode mode)
 
QIODevice::OpenMode openMode () const const
 
qint64 peek (char *data, qint64 maxSize)
 
QByteArray peek (qint64 maxSize)
 
bool putChar (char c)
 
qint64 read (char *data, qint64 maxSize)
 
QByteArray read (qint64 maxSize)
 
QByteArray readAll ()
 
int readChannelCount () const const
 
void readChannelFinished ()
 
qint64 readLine (char *data, qint64 maxSize)
 
QByteArray readLine (qint64 maxSize)
 
void readyRead ()
 
virtual bool reset ()
 
void rollbackTransaction ()
 
void setCurrentReadChannel (int channel)
 
void setCurrentWriteChannel (int channel)
 
void setTextModeEnabled (bool enabled)
 
qint64 skip (qint64 maxSize)
 
void startTransaction ()
 
void ungetChar (char c)
 
virtual bool waitForBytesWritten (int msecs)
 
virtual bool waitForReadyRead (int msecs)
 
qint64 write (const char *data)
 
qint64 write (const char *data, qint64 maxSize)
 
qint64 write (const QByteArray &byteArray)
 
int writeChannelCount () const const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 
- Public Member Functions inherited from KNetwork::KSocketBase
 KSocketBase ()
 
virtual ~KSocketBase ()
 
bool addressReuseable () const
 
bool blocking () const
 
bool broadcast () const
 
SocketError error () const
 
QString errorString () const
 
bool isIPv6Only () const
 
QMutexmutex () const
 
bool noDelay () const
 
virtual bool setAddressReuseable (bool enable)
 
virtual bool setBlocking (bool enable)
 
virtual bool setBroadcast (bool enable)
 
virtual bool setIPv6Only (bool enable)
 
virtual bool setNoDelay (bool enable)
 
int setRequestedCapabilities (int add, int remove=0)
 
KSocketDevicesocketDevice () const
 
- Public Member Functions inherited from KNetwork::KPassiveSocketBase
 KPassiveSocketBase ()
 
 ~KPassiveSocketBase () override
 

Static Public Member Functions

static void addNewImpl (KSocketDeviceFactoryBase *factory, int capabilities)
 
static KSocketDevicecreateDefault (KSocketBase *parent)
 
static KSocketDevicecreateDefault (KSocketBase *parent, int capabilities)
 
static KSocketDeviceFactoryBasesetDefaultImpl (KSocketDeviceFactoryBase *factory)
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Static Public Member Functions inherited from KNetwork::KSocketBase
static QString errorString (SocketError code)
 
static bool isFatalError (int code)
 

Protected Member Functions

 KSocketDevice (bool, const KSocketBase *parent=nullptr)
 
virtual QSocketNotifiercreateNotifier (QSocketNotifier::Type type) const
 
- Protected Member Functions inherited from KNetwork::KActiveSocketBase
qint64 readData (char *data, qint64 len) override
 
void resetError ()
 
void setError (SocketError error)
 
qint64 writeData (const char *data, qint64 len) override
 
- Protected Member Functions inherited from QIODevice
virtual qint64 readLineData (char *data, qint64 maxSize)
 
void setErrorString (const QString &str)
 
void setOpenMode (QIODevice::OpenMode openMode)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 
- Protected Member Functions inherited from KNetwork::KSocketBase
bool hasDevice () const
 
void resetError ()
 
void setError (SocketError error)
 
virtual int socketOptions () const
 

Protected Attributes

int m_sockfd
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Public Attributes inherited from QIODevice
 Append
 
 ExistingOnly
 
 NewOnly
 
 NotOpen
 
typedef OpenMode
 
 ReadOnly
 
 ReadWrite
 
 Text
 
 Truncate
 
 Unbuffered
 
 WriteOnly
 
- Public Attributes inherited from QObject
typedef QObjectList
 

Detailed Description

Low-level socket functionality.

This class provides low-level socket functionality.

Most users will prefer "cooked" interfaces like those of KStreamSocket or KServerSocket.

Descended classes from this one provide some other kinds of socket functionality, like proxying or specific socket types.

Author
Thiago Macieira thiag[email protected][email protected][email protected]e.org
Deprecated:
Use KSocketFactory or KLocalSocket instead

Definition at line 52 of file k3socketdevice.h.

Member Enumeration Documentation

◆ Capabilities

Capabilities for the socket implementation.

KSocketDevice-derived classes can implement certain capabilities that are not available in the default class. These capabilities are described by these flags. The default KSocketDevice class has none of these capabilities.

For the negative capabilities (inabilities, the CanNot* forms), when a capability is not present, the implementation will default to the original behaviour.

Enumerator
CanConnectString 

Can connect to hostnames.

If this flag is present, the string form of connect() can be used.

CanBindString 

Can bind to hostnames.

If this flag is present, the string form of bind() can be used

CanNotBind 

Can not bind.

If this flag is present, this implementation cannot bind

CanNotListen 

Can not listen.

If this flag is present, this implementation cannot listen

CanMulticast 

Can send multicast as well as join/leave multicast groups.

CanNotUseDatagrams 

Can not use datagrams.

Note that this implies multicast capability not being available either.

Definition at line 65 of file k3socketdevice.h.

Constructor & Destructor Documentation

◆ KSocketDevice() [1/4]

KSocketDevice::KSocketDevice ( const KSocketBase parent = nullptr,
QObject objparent = nullptr 
)
explicit

Default constructor.

The parameter is used to specify which socket this object is used as a device for.

Definition at line 81 of file k3socketdevice.cpp.

◆ KSocketDevice() [2/4]

KSocketDevice::KSocketDevice ( int  fd,
OpenMode  mode = ReadWrite 
)
explicit

Constructs a new object around an already-open socket.

Note: you should write programs that create sockets through the classes whenever possible.

Definition at line 91 of file k3socketdevice.cpp.

◆ KSocketDevice() [3/4]

KSocketDevice::KSocketDevice ( QObject parent)

QObject constructor.

Definition at line 102 of file k3socketdevice.cpp.

◆ ~KSocketDevice()

KSocketDevice::~KSocketDevice ( )
override

Destructor.

This closes the socket if it's open.

Definition at line 117 of file k3socketdevice.cpp.

◆ KSocketDevice() [4/4]

KSocketDevice::KSocketDevice ( bool  ,
const KSocketBase parent = nullptr 
)
explicitprotected

Special constructor.

This constructor will cause the internal socket device NOT to be set. Use this if your socket device class takes another underlying socket device.

Parameters
parentthe parent, if any

Definition at line 108 of file k3socketdevice.cpp.

Member Function Documentation

◆ accept()

KSocketDevice * KSocketDevice::accept ( )
overridevirtual

Accepts a new incoming connection.

Note: this function returns a socket of type KSocketDevice.

Implements KNetwork::KPassiveSocketBase.

Definition at line 362 of file k3socketdevice.cpp.

◆ addNewImpl()

void KSocketDevice::addNewImpl ( KSocketDeviceFactoryBase factory,
int  capabilities 
)
static

Adds a factory of KSocketDevice objects to the list, along with its capabilities flag.

Definition at line 932 of file k3socketdevice.cpp.

◆ bind()

bool KSocketDevice::bind ( const KResolverEntry address)
overridevirtual

Binds this socket to the given address.

Implements KNetwork::KActiveSocketBase.

Definition at line 281 of file k3socketdevice.cpp.

◆ bytesAvailable()

qint64 KSocketDevice::bytesAvailable ( ) const
overridevirtual

Returns the number of bytes available for reading without blocking.

Reimplemented from QIODevice.

Definition at line 417 of file k3socketdevice.cpp.

◆ capabilities()

int KSocketDevice::capabilities ( ) const
virtual

Returns the set of capabilities this socket class implements.

The set of capabilities is defined as an OR-ed mask of Capabilities bits.

The default implementation is guaranteed to always return 0. That is, derived implementations always return bits where they differ from the system standard sockets.

Definition at line 129 of file k3socketdevice.cpp.

◆ close()

void KSocketDevice::close ( )
overridevirtual

Closes the socket.

Reimplemented from QIODevice.

Use this function to close the socket this object is holding open.

Implements KNetwork::KPassiveSocketBase.

Definition at line 223 of file k3socketdevice.cpp.

◆ connect()

bool KSocketDevice::connect ( const KResolverEntry address,
OpenMode  mode = ReadWrite 
)
overridevirtual

Connect to a remote host.

Implements KNetwork::KActiveSocketBase.

Definition at line 328 of file k3socketdevice.cpp.

◆ create() [1/2]

bool KSocketDevice::create ( const KResolverEntry address)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Creates a socket but don't connect or bind anywhere.

Definition at line 276 of file k3socketdevice.cpp.

◆ create() [2/2]

bool KSocketDevice::create ( int  family,
int  type,
int  protocol 
)
virtual

Creates a socket but don't connect or bind anywhere.

This function is the equivalent of the system call socket(2).

Definition at line 251 of file k3socketdevice.cpp.

◆ createDefault() [1/2]

KSocketDevice * KSocketDevice::createDefault ( KSocketBase parent)
static

Creates a new default KSocketDevice object given the parent object.

The capabilities flag indicates the desired capabilities the object being created should possess. Those capabilities are not guaranteed: if no factory can provide such an object, a default object will be created.

Parameters
parentthe KSocketBase parent

Definition at line 889 of file k3socketdevice.cpp.

◆ createDefault() [2/2]

KSocketDevice * KSocketDevice::createDefault ( KSocketBase parent,
int  capabilities 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This will create an object only if the requested capabilities match.

Parameters
parentthe parent
capabilitiesthe requested capabilities

Definition at line 904 of file k3socketdevice.cpp.

◆ createNotifier()

QSocketNotifier * KSocketDevice::createNotifier ( QSocketNotifier::Type  type) const
protectedvirtual

Creates a socket notifier of the given type.

This function is called by readNotifier(), writeNotifier() and exceptionNotifier() when they need to create a socket notifier (i.e., the first call to those functions after the socket is open). After that call, those functions cache the socket notifier and will not need to call this function again.

Reimplement this function in your derived class if your socket type requires a different kind of QSocketNotifier. The return value should be deleteable with delete. (close() deletes them).

Parameters
typethe socket notifier type

Definition at line 826 of file k3socketdevice.cpp.

◆ disconnect()

bool KSocketDevice::disconnect ( )
overridevirtual

Disconnects this socket.

Implements KNetwork::KActiveSocketBase.

Definition at line 385 of file k3socketdevice.cpp.

◆ exceptionNotifier()

QSocketNotifier * KSocketDevice::exceptionNotifier ( ) const

Returns a socket notifier for exceptional events on this socket.

The is created only when requested.

This function might return NULL.

Definition at line 682 of file k3socketdevice.cpp.

◆ externalAddress()

KSocketAddress KSocketDevice::externalAddress ( ) const
overridevirtual

Returns this socket's externally visible local address.

If this socket has a local address visible externally different from the normal local address (as returned by localAddress()), then return it.

Certain implementations will use proxies and thus have externally visible addresses different from the local socket values. The default implementation returns the same value as localAddress().

Note
This function may return an empty KSocketAddress. In that case, the externally visible address could/can not be determined.

Implements KNetwork::KPassiveSocketBase.

Definition at line 637 of file k3socketdevice.cpp.

◆ flush()

bool KSocketDevice::flush ( )
virtual

This call is not supported on sockets.

Reimplemented from QIODevice.

Definition at line 246 of file k3socketdevice.cpp.

◆ listen()

bool KSocketDevice::listen ( int  backlog = 5)
overridevirtual

Puts this socket into listening mode.

Implements KNetwork::KPassiveSocketBase.

Definition at line 309 of file k3socketdevice.cpp.

◆ localAddress()

KSocketAddress KSocketDevice::localAddress ( ) const
overridevirtual

Returns this socket's local address.

Implements KNetwork::KActiveSocketBase.

Definition at line 555 of file k3socketdevice.cpp.

◆ peekData()

qint64 KSocketDevice::peekData ( char *  data,
qint64  maxlen,
KSocketAddress from = nullptr 
)
overridevirtual

Peeks the data in the socket and the source address.

Implements KNetwork::KActiveSocketBase.

Definition at line 499 of file k3socketdevice.cpp.

◆ peerAddress()

KSocketAddress KSocketDevice::peerAddress ( ) const
overridevirtual

Returns this socket's peer address.

If this implementation does proxying of some sort, this is the real external address, not the proxy's address.

Implements KNetwork::KActiveSocketBase.

Definition at line 596 of file k3socketdevice.cpp.

◆ poll() [1/2]

bool KSocketDevice::poll ( bool *  input,
bool *  output,
bool *  exception = nullptr,
int  timeout = -1,
bool *  timedout = nullptr 
)
virtual

Executes a poll in the socket, via select(2) or poll(2).

The events polled are returned in the parameters pointers. Set any of them to NULL to disable polling of that event.

On exit, input, output and exception will contain true if an event of that kind is waiting on the socket or false if not. If a timeout occurred, set timedout to true (all other parameters are necessarily set to false).

Parameters
inputif set, turns on polling for input events
outputif set, turns on polling for output events
exceptionif set, turns on polling for exceptional events
timeoutthe time in milliseconds to wait for an event; 0 for no wait and any negative value to wait forever
timedouton exit, will contain true if the polling timed out
Returns
true if the poll call succeeded and false if an error occurred

Definition at line 701 of file k3socketdevice.cpp.

◆ poll() [2/2]

bool KSocketDevice::poll ( int  timeout = -1,
bool *  timedout = nullptr 
)

Shorter version to poll for any events in a socket.

This call polls for input, output and exceptional events in a socket but does not return their states. This is useful if you need to wait for any event, but don't need to know which; or for timeouts.

Parameters
timeoutthe time in milliseconds to wait for an event; 0 for no wait and any negative value to wait forever
timedouton exit, will contain true if the polling timed out
Returns
true if the poll call succeeded and false if an error occurred

Definition at line 820 of file k3socketdevice.cpp.

◆ readData()

qint64 KSocketDevice::readData ( char *  data,
qint64  maxlen,
KSocketAddress from = nullptr 
)
overridevirtual

Reads data and the source address from this socket.

Implements KNetwork::KActiveSocketBase.

Definition at line 477 of file k3socketdevice.cpp.

◆ readNotifier()

QSocketNotifier * KSocketDevice::readNotifier ( ) const

Returns a socket notifier for input on this socket.

The notifier is created only when requested. Whether it is enabled or not depends on the implementation.

This function might return NULL.

Definition at line 644 of file k3socketdevice.cpp.

◆ setDefaultImpl()

KSocketDeviceFactoryBase * KSocketDevice::setDefaultImpl ( KSocketDeviceFactoryBase factory)
static

Sets the default KSocketDevice implementation to use and return the old factory.

Parameters
factorythe factory object for the implementation

Definition at line 924 of file k3socketdevice.cpp.

◆ setSocketOptions()

bool KSocketDevice::setSocketOptions ( int  opts)
overridevirtual

This implementation sets the options on the socket.

Reimplemented from KNetwork::KSocketBase.

Definition at line 134 of file k3socketdevice.cpp.

◆ socket()

int KSocketDevice::socket ( ) const

Returns the file descriptor for this socket.

Definition at line 124 of file k3socketdevice.cpp.

◆ waitForMore()

qint64 KSocketDevice::waitForMore ( int  msecs,
bool *  timeout = nullptr 
)
overridevirtual

Waits up to msecs for more data to be available on this socket.

This function is a wrapper against poll(). This function will wait for any read events.

Implements KNetwork::KActiveSocketBase.

Definition at line 431 of file k3socketdevice.cpp.

◆ writeData()

qint64 KSocketDevice::writeData ( const char *  data,
qint64  len,
const KSocketAddress to = nullptr 
)
overridevirtual

Writes the given data to the given destination address.

Implements KNetwork::KActiveSocketBase.

Definition at line 521 of file k3socketdevice.cpp.

◆ writeNotifier()

QSocketNotifier * KSocketDevice::writeNotifier ( ) const

Returns a socket notifier for output on this socket.

The is created only when requested.

This function might return NULL.

Definition at line 663 of file k3socketdevice.cpp.

Member Data Documentation

◆ m_sockfd

int KNetwork::KSocketDevice::m_sockfd
protected

The socket file descriptor.

It is used throughout the implementation and subclasses.

Definition at line 96 of file k3socketdevice.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
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.