#include <kbufferedsocket.h>

Signals | |
void | bytesWritten (int bytes) |
![]() | |
void | timedOut () |
![]() | |
void | stateChanged (int newstate) |
void | gotError (int code) |
void | hostFound () |
void | bound (const KResolverEntry &local) |
void | aboutToConnect (const KResolverEntry &remote, bool &skip) |
void | connected (const KResolverEntry &remote) |
void | closed () |
void | readyRead () |
void | readyWrite () |
Public Member Functions | |
TDEBufferedSocket (const TQString &node=TQString::null, const TQString &service=TQString::null, TQObject *parent=0L, const char *name=0L) | |
virtual | ~TDEBufferedSocket () |
virtual void | setSocketDevice (TDESocketDevice *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, TDESocketAddress &from) |
virtual TQ_LONG | peekBlock (char *data, TQ_ULONG maxlen) |
virtual TQ_LONG | peekBlock (char *data, TQ_ULONG maxlen, TDESocketAddress &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 TDESocketAddress &to) |
virtual void | enableRead (bool enable) |
virtual void | enableWrite (bool enable) |
void | setInputBuffering (bool enable) |
TDEIOBufferBase * | inputBuffer () |
void | setOutputBuffering (bool enable) |
TDEIOBufferBase * | outputBuffer () |
virtual void | closeNow () |
bool | canReadLine () const |
TQCString | readLine () |
void | waitForConnect () |
![]() | |
KStreamSocket (const TQString &node=TQString::null, const TQString &service=TQString::null, TQObject *parent=0L, const char *name=0L) | |
virtual | ~KStreamSocket () |
int | timeout () const |
int | remainingTimeout () const |
void | setTimeout (int msecs) |
virtual bool | bind (const TQString &node=TQString::null, const TQString &service=TQString::null) |
virtual bool | bind (const KResolverEntry &entry) |
virtual bool | connect (const TQString &node=TQString::null, const TQString &service=TQString::null) |
virtual bool | connect (const KResolverEntry &entry) |
![]() | |
KClientSocketBase (TQObject *parent, const char *name) | |
virtual | ~KClientSocketBase () |
SocketState | state () const |
KResolver & | peerResolver () const |
const KResolverResults & | peerResults () const |
KResolver & | localResolver () const |
const KResolverResults & | localResults () const |
void | setResolutionEnabled (bool enable) |
void | setFamily (int families) |
virtual bool | lookup () |
void | connectToHost (const TQString &host, TQ_UINT16 port) |
virtual bool | disconnect () |
virtual bool | open (TQ_OpenMode) |
virtual void | flush () |
virtual TDESocketAddress | localAddress () const |
virtual TDESocketAddress | peerAddress () const |
bool | emitsReadyRead () const |
bool | emitsReadyWrite () const |
![]() | |
KActiveSocketBase () | |
virtual | ~KActiveSocketBase () |
virtual Offset | size () const |
virtual Offset | at () const |
virtual bool | at (Offset) |
virtual bool | atEnd () const |
virtual int | getch () |
virtual int | putch (int ch) |
virtual int | ungetch (int) |
![]() | |
TDESocketBase () | |
virtual | ~TDESocketBase () |
virtual bool | setBlocking (bool enable) |
bool | blocking () const |
virtual bool | setAddressReuseable (bool enable) |
bool | addressReuseable () const |
virtual bool | setIPv6Only (bool enable) |
bool | isIPv6Only () const |
virtual bool | setBroadcast (bool enable) |
bool | broadcast () const |
TDESocketDevice * | socketDevice () const |
int | setRequestedCapabilities (int add, int remove=0) |
SocketError | error () const |
TQString | errorString () const |
TQMutex * | mutex () const |
Protected Slots | |
virtual void | slotReadActivity () |
virtual void | slotWriteActivity () |
![]() | |
virtual void | slotReadActivity () |
virtual void | slotWriteActivity () |
Protected Member Functions | |
virtual bool | setSocketOptions (int opts) |
virtual void | stateChanging (SocketState newState) |
![]() | |
void | setState (SocketState state) |
void | copyError () |
![]() | |
void | setError (int status, SocketError error) |
void | resetError () |
![]() | |
virtual int | socketOptions () const |
bool | hasDevice () const |
void | setError (SocketError error) |
Additional Inherited Members | |
![]() | |
enum | SocketState { Idle, HostLookup, HostFound, Bound, Connecting, Open, Closing, Unconnected = Bound, Connected = Open, Connection = Open } |
![]() | |
enum | SocketOptions { Blocking = 0x01, AddressReuseable = 0x02, IPv6Only = 0x04, Keepalive = 0x08, Broadcast = 0x10 } |
enum | SocketError { NoError = 0, LookupFailure, AddressInUse, AlreadyCreated, AlreadyBound, AlreadyConnected, NotConnected, NotBound, NotCreated, WouldBlock, ConnectionRefused, ConnectionTimedOut, InProgress, NetFailure, NotSupported, Timeout, UnknownError, RemotelyDisconnected } |
![]() | |
static TQString | errorString (SocketError code) |
static bool | isFatalError (int code) |
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.
Definition at line 58 of file kbufferedsocket.h.
Constructor & Destructor Documentation
TDEBufferedSocket::TDEBufferedSocket | ( | const TQString & | node = TQString::null , |
const TQString & | service = TQString::null , |
||
TQObject * | parent = 0L , |
||
const char * | name = 0L |
||
) |
Default constructor.
- Parameters
-
node destination host service destination service to connect to parent the parent object for this object name the internal name for this object
Definition at line 50 of file kbufferedsocket.cpp.
|
virtual |
Destructor.
Definition at line 59 of file kbufferedsocket.cpp.
Member Function Documentation
|
signal |
This signal is emitted whenever data is written.
bool TDEBufferedSocket::canReadLine | ( | ) | const |
Returns true if a line can be read with readLine.
Definition at line 307 of file kbufferedsocket.cpp.
|
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 |
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
Definition at line 300 of file kbufferedsocket.cpp.
|
virtual |
Catch changes.
Reimplemented from KNetwork::KClientSocketBase.
Definition at line 202 of file kbufferedsocket.cpp.
|
virtual |
Catch changes.
Reimplemented from KNetwork::KClientSocketBase.
Definition at line 219 of file kbufferedsocket.cpp.
TDEIOBufferBase * TDEBufferedSocket::inputBuffer | ( | ) |
Retrieves the input buffer object.
Definition at line 263 of file kbufferedsocket.cpp.
TDEIOBufferBase * TDEBufferedSocket::outputBuffer | ( | ) |
Retrieves the output buffer object.
Definition at line 282 of file kbufferedsocket.cpp.
|
virtual |
Peeks data from the socket.
Reimplemented from KNetwork::KClientSocketBase.
Definition at line 143 of file kbufferedsocket.cpp.
|
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 TDEBufferedSocket::readLine | ( | ) |
Reads a line of data from the socket buffers.
Definition at line 315 of file kbufferedsocket.cpp.
void TDEBufferedSocket::setInputBuffering | ( | bool | enable | ) |
Sets the use of input buffering.
Definition at line 249 of file kbufferedsocket.cpp.
void TDEBufferedSocket::setOutputBuffering | ( | bool | enable | ) |
Sets the use of output buffering.
Definition at line 268 of file kbufferedsocket.cpp.
|
virtual |
Be sure to catch new devices.
Reimplemented from KNetwork::TDESocketBase.
Definition at line 67 of file kbufferedsocket.cpp.
|
protectedvirtual |
Buffered sockets can only operate in non-blocking mode.
Reimplemented from KNetwork::KClientSocketBase.
Definition at line 73 of file kbufferedsocket.cpp.
|
protectedvirtualslot |
Slot called when there's read activity.
Definition at line 330 of file kbufferedsocket.cpp.
|
protectedvirtualslot |
Slot called when there's write activity.
Definition at line 377 of file kbufferedsocket.cpp.
|
protectedvirtual |
Catch connection to clear the buffers.
Reimplemented from KNetwork::KClientSocketBase.
Definition at line 231 of file kbufferedsocket.cpp.
|
virtual |
Reads data from the socket.
Make use of buffers.
Reimplemented from KNetwork::KClientSocketBase.
Definition at line 121 of file kbufferedsocket.cpp.
|
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.
|
virtual |
Writes data to the socket.
Reimplemented from KNetwork::KClientSocketBase.
Definition at line 165 of file kbufferedsocket.cpp.
|
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 TDEBufferedSocket::waitForConnect | ( | ) |
Blocks until the connection is either established, or completely failed.
Definition at line 320 of file kbufferedsocket.cpp.
|
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: