• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kdecore
 

kdecore

  • KNetwork
  • KBufferedSocket
Signals | Public Member Functions | Protected Slots | Protected Member Functions
KNetwork::KBufferedSocket Class Reference

#include <kbufferedsocket.h>

Inheritance diagram for KNetwork::KBufferedSocket:
KNetwork::KStreamSocket KNetwork::KClientSocketBase

List of all members.

Signals

void bytesWritten (int bytes)

Public Member Functions

 KBufferedSocket (const TQString &node=TQString::null, const TQString &service=TQString::null, TQObject *parent=0L, const char *name=0L)
virtual ~KBufferedSocket ()
virtual void setSocketDevice (KSocketDevice *device)
virtual void close ()
virtual TQ_LONG waitForMore (int msecs, bool *timeout=0L)
virtual TQT_TQIO_LONG tqreadBlock (char *data, TQT_TQIO_ULONG maxlen)
virtual TQT_TQIO_LONG tqreadBlock (char *data, TQT_TQIO_ULONG maxlen, KSocketAddress &from)
virtual TQ_LONG peekBlock (char *data, TQ_ULONG maxlen)
virtual TQ_LONG peekBlock (char *data, TQ_ULONG maxlen, KSocketAddress &from)
virtual TQT_TQIO_LONG tqwriteBlock (const char *data, TQT_TQIO_ULONG len)
virtual TQT_TQIO_LONG tqwriteBlock (const char *data, TQT_TQIO_ULONG len, const KSocketAddress &to)
virtual void enableRead (bool enable)
virtual void enableWrite (bool enable)
void setInputBuffering (bool enable)
KIOBufferBase * inputBuffer ()
void setOutputBuffering (bool enable)
KIOBufferBase * outputBuffer ()
virtual void closeNow ()
bool canReadLine () const
TQCString readLine ()
void waitForConnect ()

Protected Slots

virtual void slotReadActivity ()
virtual void slotWriteActivity ()

Protected Member Functions

virtual bool setSocketOptions (int opts)
virtual void stateChanging (SocketState newState)

Detailed Description

Buffered stream sockets.

This class allows the user to create and operate buffered stream sockets such as those used in most Internet connections. This class is also the one that resembles the most to the old QSocket implementation.

Objects of this type operate only in non-blocking mode. A call to setBlocking(true) will result in an error.

Note:
Buffered sockets only make sense if you're using them from the main (event-loop) thread. This is actually a restriction imposed by Qt's TQSocketNotifier. If you want to use a socket in an auxiliary thread, please use KStreamSocket.
See also:
KNetwork::KStreamSocket, KNetwork::KServerSocket
Author:
Thiago Macieira <thiago@kde.org>

Definition at line 58 of file kbufferedsocket.h.


Constructor & Destructor Documentation

KBufferedSocket::KBufferedSocket ( const TQString &  node = TQString::null,
const TQString &  service = TQString::null,
TQObject *  parent = 0L,
const char *  name = 0L 
)

Default constructor.

Parameters:
nodedestination host
servicedestination service to connect to
parentthe parent object for this object
namethe internal name for this object

Definition at line 50 of file kbufferedsocket.cpp.

KBufferedSocket::~KBufferedSocket ( ) [virtual]

Destructor.

Definition at line 59 of file kbufferedsocket.cpp.


Member Function Documentation

void KNetwork::KBufferedSocket::bytesWritten ( int  bytes) [signal]

This signal is emitted whenever data is written.

bool KNetwork::KBufferedSocket::canReadLine ( ) const

Returns true if a line can be read with readLine.

void KBufferedSocket::close ( ) [virtual]

Closes the socket for new data, but allow data that had been buffered for output with writeBlock to be still be written.

See also:
closeNow

Reimplemented from KNetwork::KClientSocketBase.

Definition at line 82 of file kbufferedsocket.cpp.

virtual void KNetwork::KBufferedSocket::closeNow ( ) [virtual]

Returns the length of the output buffer.

Closes the socket and discards any output data that had been buffered with writeBlock but that had not yet been written.

See also:
close
void KBufferedSocket::enableRead ( bool  enable) [virtual]

Catch changes.

Reimplemented from KNetwork::KClientSocketBase.

Definition at line 202 of file kbufferedsocket.cpp.

void KBufferedSocket::enableWrite ( bool  enable) [virtual]

Catch changes.

Reimplemented from KNetwork::KClientSocketBase.

Definition at line 219 of file kbufferedsocket.cpp.

KIOBufferBase * KBufferedSocket::inputBuffer ( )

Retrieves the input buffer object.

Definition at line 263 of file kbufferedsocket.cpp.

KIOBufferBase * KBufferedSocket::outputBuffer ( )

Retrieves the output buffer object.

Definition at line 282 of file kbufferedsocket.cpp.

TQ_LONG KBufferedSocket::peekBlock ( char *  data,
TQ_ULONG  maxlen 
) [virtual]

Peeks data from the socket.

Reimplemented from KNetwork::KClientSocketBase.

Definition at line 143 of file kbufferedsocket.cpp.

TQ_LONG KBufferedSocket::peekBlock ( char *  data,
TQ_ULONG  maxlen,
KSocketAddress &  from 
) [virtual]

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

The from parameter is always set to peerAddress()

Reimplemented from KNetwork::KClientSocketBase.

Definition at line 159 of file kbufferedsocket.cpp.

TQCString KNetwork::KBufferedSocket::readLine ( )

Reads a line of data from the socket buffers.

void KBufferedSocket::setInputBuffering ( bool  enable)

Sets the use of input buffering.

Definition at line 249 of file kbufferedsocket.cpp.

void KBufferedSocket::setOutputBuffering ( bool  enable)

Sets the use of output buffering.

Definition at line 268 of file kbufferedsocket.cpp.

void KBufferedSocket::setSocketDevice ( KSocketDevice *  device) [virtual]

Be sure to catch new devices.

Definition at line 67 of file kbufferedsocket.cpp.

bool KBufferedSocket::setSocketOptions ( int  opts) [protected, virtual]

Buffered sockets can only operate in non-blocking mode.

Reimplemented from KNetwork::KClientSocketBase.

Definition at line 73 of file kbufferedsocket.cpp.

virtual void KNetwork::KBufferedSocket::slotReadActivity ( ) [protected, virtual, slot]

Slot called when there's read activity.

Reimplemented from KNetwork::KClientSocketBase.

virtual void KNetwork::KBufferedSocket::slotWriteActivity ( ) [protected, virtual, slot]

Slot called when there's write activity.

Reimplemented from KNetwork::KClientSocketBase.

void KBufferedSocket::stateChanging ( SocketState  newState) [protected, virtual]

Catch connection to clear the buffers.

Reimplemented from KNetwork::KClientSocketBase.

Definition at line 231 of file kbufferedsocket.cpp.

TQT_TQIO_LONG KBufferedSocket::tqreadBlock ( char *  data,
TQT_TQIO_ULONG  maxlen 
) [virtual]

Reads data from the socket.

Make use of buffers.

Reimplemented from KNetwork::KClientSocketBase.

Definition at line 121 of file kbufferedsocket.cpp.

TQT_TQIO_LONG KBufferedSocket::tqreadBlock ( char *  data,
TQT_TQIO_ULONG  maxlen,
KSocketAddress &  from 
) [virtual]

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

The from parameter is always set to peerAddress()

Reimplemented from KNetwork::KClientSocketBase.

Definition at line 137 of file kbufferedsocket.cpp.

TQT_TQIO_LONG KBufferedSocket::tqwriteBlock ( const char *  data,
TQT_TQIO_ULONG  len 
) [virtual]

Writes data to the socket.

Reimplemented from KNetwork::KClientSocketBase.

Definition at line 165 of file kbufferedsocket.cpp.

TQT_TQIO_LONG KBufferedSocket::tqwriteBlock ( const char *  data,
TQT_TQIO_ULONG  len,
const KSocketAddress &  to 
) [virtual]

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

The to parameter is discarded.

Reimplemented from KNetwork::KClientSocketBase.

Definition at line 195 of file kbufferedsocket.cpp.

void KNetwork::KBufferedSocket::waitForConnect ( )

Blocks until the connection is either established, or completely failed.

TQ_LONG KBufferedSocket::waitForMore ( int  msecs,
bool *  timeout = 0L 
) [virtual]

Make use of the buffers.

Make use of buffers.

Reimplemented from KNetwork::KClientSocketBase.

Definition at line 109 of file kbufferedsocket.cpp.


The documentation for this class was generated from the following files:
  • kbufferedsocket.h
  • kbufferedsocket.cpp

kdecore

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

kdecore

Skip menu "kdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdecore by doxygen 1.7.6.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |