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

KDECore

  • KNetwork
  • KActiveSocketBase
Public Member Functions | Protected Member Functions | List of all members
KNetwork::KActiveSocketBase Class Referenceabstract

#include <k3socketbase.h>

Inheritance diagram for KNetwork::KActiveSocketBase:
Inheritance graph
[legend]

Public Member Functions

 KActiveSocketBase (QObject *parent)
 
virtual ~KActiveSocketBase ()
 
virtual bool atEnd () const
 
virtual bool bind (const KResolverEntry &address)=0
 
virtual bool connect (const KResolverEntry &address, OpenMode mode=ReadWrite)=0
 
virtual bool disconnect ()=0
 
QString errorString () const
 
virtual bool isSequential () const
 
virtual KSocketAddress localAddress () const =0
 
virtual bool open (OpenMode mode)
 
qint64 peek (char *data, qint64 maxlen)
 
qint64 peek (char *data, qint64 maxlen, KSocketAddress &from)
 
virtual KSocketAddress peerAddress () const =0
 
virtual qint64 pos () const
 
qint64 read (char *data, qint64 maxlen)
 
QByteArray read (qint64 len)
 
qint64 read (char *data, qint64 maxlen, KSocketAddress &from)
 
virtual bool seek (qint64)
 
virtual void setSocketDevice (KSocketDevice *device)
 
virtual qint64 size () const
 
void ungetChar (char)
 
virtual qint64 waitForMore (int msecs, bool *timeout=0L)=0
 
qint64 write (const char *data, qint64 len)
 
qint64 write (const QByteArray &data)
 
qint64 write (const char *data, qint64 len, const KSocketAddress &to)
 
- Public Member Functions inherited from QIODevice
 QIODevice ()
 
 QIODevice (QObject *parent)
 
virtual  ~QIODevice ()
 
void aboutToClose ()
 
Offset at () const
 
bool at (Offset offset)
 
virtual qint64 bytesAvailable () const
 
virtual qint64 bytesToWrite () const
 
void bytesWritten (qint64 bytes)
 
virtual bool canReadLine () const
 
virtual void close ()
 
QString errorString () const
 
int flags () const
 
int getch ()
 
bool getChar (char *c)
 
bool isAsynchronous () const
 
bool isBuffered () const
 
bool isCombinedAccess () const
 
bool isDirectAccess () const
 
bool isInactive () const
 
bool isOpen () const
 
bool isRaw () const
 
bool isReadable () const
 
bool isSequentialAccess () const
 
bool isSynchronous () const
 
bool isTextModeEnabled () const
 
bool isTranslated () const
 
bool isWritable () const
 
int mode () const
 
virtual bool open (QFlags< QIODevice::OpenModeFlag > mode)
 
OpenMode openMode () const
 
qint64 peek (char *data, qint64 maxSize)
 
QByteArray peek (qint64 maxSize)
 
int putch (int ch)
 
bool putChar (char c)
 
qint64 read (char *data, qint64 maxSize)
 
QByteArray read (qint64 maxSize)
 
QByteArray readAll ()
 
qint64 readBlock (char *data, quint64 size)
 
void readChannelFinished ()
 
QByteArray readLine (qint64 maxSize)
 
qint64 readLine (char *data, qint64 maxSize)
 
void readyRead ()
 
virtual bool reset ()
 
void resetStatus ()
 
void setTextModeEnabled (bool enabled)
 
int state () const
 
Status status () const
 
int ungetch (int ch)
 
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)
 
qint64 writeBlock (const QByteArray &data)
 
qint64 writeBlock (const char *data, quint64 size)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObject * child (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
T findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThread * thread () 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
 
QMutex * mutex () 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)
 
KSocketDevice * socketDevice () const
 

Protected Member Functions

virtual qint64 peekData (char *data, qint64 maxlen, KSocketAddress *from)=0
 
virtual qint64 readData (char *data, qint64 len)
 
virtual qint64 readData (char *data, qint64 maxlen, KSocketAddress *from)=0
 
void resetError ()
 
void setError (SocketError error)
 
virtual qint64 writeData (const char *data, qint64 len)
 
virtual qint64 writeData (const char *data, qint64 len, const KSocketAddress *to)=0
 
- Protected Member Functions inherited from QIODevice
virtual qint64 readData (char *data, qint64 maxSize)=0
 
virtual qint64 readLineData (char *data, qint64 maxSize)
 
void setErrorString (const QString &str)
 
void setOpenMode (QFlags< QIODevice::OpenModeFlag > openMode)
 
virtual qint64 writeData (const char *data, qint64 maxSize)=0
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Protected Member Functions inherited from KNetwork::KSocketBase
bool hasDevice () const
 
void resetError ()
 
void setError (SocketError error)
 
virtual bool setSocketOptions (int opts)
 
virtual int socketOptions () const
 

Additional Inherited Members

- 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
}
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
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)
 
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)
 
- Public Attributes inherited from QIODevice
typedef Offset
 
typedef OpenMode
 
typedef Status
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Abstract class for active sockets.

This class provides the standard interfaces for active sockets, i.e., sockets that are used to connect to external addresses.

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

Definition at line 461 of file k3socketbase.h.

Constructor & Destructor Documentation

KActiveSocketBase::KActiveSocketBase ( QObject *  parent)

Constructor.

Definition at line 325 of file k3socketbase.cpp.

KActiveSocketBase::~KActiveSocketBase ( )
virtual

Destructor.

Definition at line 330 of file k3socketbase.cpp.

Member Function Documentation

bool KActiveSocketBase::atEnd ( ) const
virtual

This call is not supported on sockets.

Reimplemented from QIODevice. This will always return true.

Reimplemented from QIODevice.

Definition at line 373 of file k3socketbase.cpp.

virtual bool KNetwork::KActiveSocketBase::bind ( const KResolverEntry &  address)
pure virtual

Binds this socket to the given address.

The socket will be constructed with the address family, socket type and protocol as those given in the address object.

Parameters
addressthe address to bind to
Returns
true if the binding was successful, false otherwise

Implemented in KNetwork::KDatagramSocket, KNetwork::KClientSocketBase, KNetwork::KStreamSocket, KNetwork::KSocketDevice, and KNetwork::KSocksSocketDevice.

virtual bool KNetwork::KActiveSocketBase::connect ( const KResolverEntry &  address,
OpenMode  mode = ReadWrite 
)
pure virtual

Connect to a remote host.

This will make this socket try to connect to the remote host. If the socket is not yet created, it will be created using the address family, socket type and protocol specified in the address object.

If this function returns with error InProgress, calling it again with the same address after a time will cause it to test if the connection has succeeded in the mean time.

Parameters
addressthe address to connect to
modemode for connection, from QIODevice
Returns
true if the connection was successful or has been successfully queued; false if an error occurred.

Implemented in KNetwork::KClientSocketBase, KNetwork::KDatagramSocket, KNetwork::KStreamSocket, and KNetwork::KSocketDevice.

virtual bool KNetwork::KActiveSocketBase::disconnect ( )
pure virtual

Disconnects this socket from a connection, if possible.

If this socket was connected to an endpoint, the connection is severed, but the socket is not closed. If the socket wasn't connected, this function does nothing.

If the socket hadn't yet been created, this function does nothing either.

Not all socket types can disconnect. Most notably, only connectionless datagram protocols such as UDP support this operation.

Returns
true if the socket is now disconnected or false on error.

Implemented in KNetwork::KClientSocketBase, and KNetwork::KSocketDevice.

QString KActiveSocketBase::errorString ( ) const

Unshadow errorString from QIODevice.

Definition at line 334 of file k3socketbase.cpp.

bool KActiveSocketBase::isSequential ( ) const
virtual

Sockets are sequential.

Reimplemented from QIODevice.

Definition at line 353 of file k3socketbase.cpp.

virtual KSocketAddress KNetwork::KActiveSocketBase::localAddress ( ) const
pure virtual

Returns this socket's local address.

Implemented in KNetwork::KClientSocketBase, KNetwork::KSocketDevice, and KNetwork::KSocksSocketDevice.

bool KActiveSocketBase::open ( OpenMode  mode)
virtual

Reimplemented from QIODevice.

Reimplemented in KNetwork::KClientSocketBase.

Definition at line 339 of file k3socketbase.cpp.

qint64 KActiveSocketBase::peek ( char *  data,
qint64  maxlen 
)

Peeks the data in the socket and the source address.

This call will allow you to peek the data to be received without actually receiving it – that is, it will be available for further peekings and for the next read call.

Parameters
datawhere to write the peeked data to
maxlenthe maximum number of bytes to peek
Returns
the actual number of bytes copied into data

Definition at line 394 of file k3socketbase.cpp.

qint64 KActiveSocketBase::peek ( char *  data,
qint64  maxlen,
KSocketAddress &  from 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Peeks the data in the socket and the source address.

This call will allow you to peek the data to be received without actually receiving it – that is, it will be available for further peekings and for the next read call.

Parameters
datawhere to write the peeked data to
maxlenthe maximum number of bytes to peek
fromthe address of the sender will be stored here
Returns
the actual number of bytes copied into data

Definition at line 399 of file k3socketbase.cpp.

virtual qint64 KNetwork::KActiveSocketBase::peekData ( char *  data,
qint64  maxlen,
KSocketAddress *  from 
)
protectedpure virtual

Peeks the data in the socket and the source address.

This call will allow you to peek the data to be received without actually receiving it – that is, it will be available for further peekings and for the next read call.

Parameters
datawhere to write the peeked data to
maxlenthe maximum number of bytes to peek
fromthe address of the sender will be stored here
Returns
the actual number of bytes copied into data

Implemented in KNetwork::KClientSocketBase, KNetwork::KSocketDevice, and KNetwork::KBufferedSocket.

virtual KSocketAddress KNetwork::KActiveSocketBase::peerAddress ( ) const
pure virtual

Return this socket's peer address, if we are connected.

If the address cannot be retrieved, the returned object will contain an invalid address.

Implemented in KNetwork::KClientSocketBase, KNetwork::KSocketDevice, KNetwork::KSocksSocketDevice, and KNetwork::KHttpProxySocketDevice.

qint64 KActiveSocketBase::pos ( ) const
virtual

This call is not supported on sockets.

Reimplemented from QIODevice. This will always return 0.

Reimplemented from QIODevice.

Definition at line 363 of file k3socketbase.cpp.

qint64 KActiveSocketBase::read ( char *  data,
qint64  maxlen 
)

Reads data from the socket.

Reimplemented from QIODevice. See QIODevice::read for more information.

Definition at line 378 of file k3socketbase.cpp.

QByteArray KActiveSocketBase::read ( qint64  len)

Reads data from the socket.

Reimplemented from QIODevice. See QIODevice::read for more information.

Definition at line 383 of file k3socketbase.cpp.

qint64 KActiveSocketBase::read ( char *  data,
qint64  maxlen,
KSocketAddress &  from 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Receives data and the source address.

This call will read data in the socket and will also place the sender's address in from object.

Parameters
datawhere to write the read data to
maxlenthe maximum number of bytes to read
fromthe address of the sender will be stored here
Returns
the actual number of bytes read

Definition at line 388 of file k3socketbase.cpp.

qint64 KActiveSocketBase::readData ( char *  data,
qint64  len 
)
protectedvirtual

Reads data from the socket.

Reimplemented from QIODevice. See QIODevice::readData for more information.

Definition at line 425 of file k3socketbase.cpp.

virtual qint64 KNetwork::KActiveSocketBase::readData ( char *  data,
qint64  maxlen,
KSocketAddress *  from 
)
protectedpure virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Receives data and the source address.

This call will read data in the socket and will also place the sender's address in from object.

Parameters
datawhere to write the read data to
maxlenthe maximum number of bytes to read
fromthe address of the sender will be stored here
Returns
the actual number of bytes read

Implemented in KNetwork::KClientSocketBase, KNetwork::KSocketDevice, and KNetwork::KBufferedSocket.

void KActiveSocketBase::resetError ( )
protected

Resets the socket error code and the I/O Device's status.

Definition at line 441 of file k3socketbase.cpp.

bool KActiveSocketBase::seek ( qint64  )
virtual

This call is not supported on sockets.

Reimplemented from QIODevice. This will always return false.

Reimplemented from QIODevice.

Definition at line 368 of file k3socketbase.cpp.

void KActiveSocketBase::setError ( SocketError  error)
protected

Sets the socket's error code.

Parameters
errorthe error code

Definition at line 435 of file k3socketbase.cpp.

void KActiveSocketBase::setSocketDevice ( KSocketDevice *  device)
virtual
Reimplemented from superclass.

Reimplemented from KNetwork::KSocketBase.

Reimplemented in KNetwork::KBufferedSocket.

Definition at line 347 of file k3socketbase.cpp.

qint64 KActiveSocketBase::size ( ) const
virtual

This call is not supported on sockets.

Reimplemented from QIODevice. This will always return 0.

Reimplemented from QIODevice.

Definition at line 358 of file k3socketbase.cpp.

void KActiveSocketBase::ungetChar ( char  )

This call is not supported on sockets.

Reimplemented from QIODevice.

Definition at line 420 of file k3socketbase.cpp.

virtual qint64 KNetwork::KActiveSocketBase::waitForMore ( int  msecs,
bool *  timeout = 0L 
)
pure virtual

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

If msecs is -1, this call will block indefinetely until more data is indeed available; if it's 0, this function returns immediately.

If timeout is not NULL, this function will set it to indicate if a timeout occurred.

Returns
the number of bytes available

Implemented in KNetwork::KClientSocketBase, KNetwork::KSocketDevice, and KNetwork::KBufferedSocket.

qint64 KActiveSocketBase::write ( const char *  data,
qint64  len 
)

Writes the given data to the socket.

Reimplemented from QIODevice. See QIODevice::write for more information.

Definition at line 404 of file k3socketbase.cpp.

qint64 KActiveSocketBase::write ( const QByteArray &  data)

Writes the given data to the socket.

Reimplemented from QIODevice. See QIODevice::write for more information.

Definition at line 409 of file k3socketbase.cpp.

qint64 KActiveSocketBase::write ( const char *  data,
qint64  len,
const KSocketAddress &  to 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Writes the given data to the destination address.

Note that not all socket connections allow sending data to different addresses than the one the socket is connected to.

Parameters
datathe data to write
lenthe length of the data
tothe address to send to
Returns
the number of bytes actually sent

Definition at line 414 of file k3socketbase.cpp.

qint64 KActiveSocketBase::writeData ( const char *  data,
qint64  len 
)
protectedvirtual

Writes the given data to the socket.

Reimplemented from QIODevice. See QIODevice::writeData for more information.

Definition at line 430 of file k3socketbase.cpp.

virtual qint64 KNetwork::KActiveSocketBase::writeData ( const char *  data,
qint64  len,
const KSocketAddress *  to 
)
protectedpure virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Writes the given data to the destination address.

Note that not all socket connections allow sending data to different addresses than the one the socket is connected to.

Parameters
datathe data to write
lenthe length of the data
tothe address to send to
Returns
the number of bytes actually sent

Implemented in KNetwork::KClientSocketBase, KNetwork::KSocketDevice, KNetwork::KDatagramSocket, and KNetwork::KBufferedSocket.


The documentation for this class was generated from the following files:
  • k3socketbase.h
  • k3socketbase.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:14 by doxygen 1.8.7 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 API Reference

Skip menu "kdelibs 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

Search



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