KNetwork::KActiveSocketBase Class Reference
Abstract class for active sockets. More...
#include <ksocketbase.h>
Inheritance diagram for KNetwork::KActiveSocketBase:

Public Member Functions | |
KActiveSocketBase () | |
virtual | ~KActiveSocketBase () |
virtual bool | bind (const KResolverEntry &address)=0 |
virtual bool | connect (const KResolverEntry &address)=0 |
virtual bool | disconnect ()=0 |
virtual Offset | size () const |
virtual Offset | at () const |
virtual bool | at (Offset) |
virtual bool | atEnd () const |
virtual Q_LONG | bytesAvailable () const =0 |
virtual Q_LONG | waitForMore (int msecs, bool *timeout=0L)=0 |
virtual Q_LONG | readBlock (char *data, Q_ULONG len)=0 |
virtual Q_LONG | readBlock (char *data, Q_ULONG maxlen, KSocketAddress &from)=0 |
virtual Q_LONG | peekBlock (char *data, Q_ULONG maxlen)=0 |
virtual Q_LONG | peekBlock (char *data, Q_ULONG maxlen, KSocketAddress &from)=0 |
virtual Q_LONG | writeBlock (const char *data, Q_ULONG len)=0 |
virtual Q_LONG | writeBlock (const char *data, Q_ULONG len, const KSocketAddress &to)=0 |
virtual int | getch () |
virtual int | putch (int ch) |
virtual int | ungetch (int) |
virtual KSocketAddress | localAddress () const =0 |
virtual KSocketAddress | peerAddress () const =0 |
Protected Member Functions | |
void | setError (int status, SocketError error) |
void | resetError () |
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 <thiago.macieira@kdemail.net>
Definition at line 440 of file ksocketbase.h.
Constructor & Destructor Documentation
|
Constructor. Definition at line 276 of file ksocketbase.cpp. |
|
Destructor. Definition at line 280 of file ksocketbase.cpp. |
Member Function Documentation
|
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
Implemented in KNetwork::KClientSocketBase, KNetwork::KDatagramSocket, KNetwork::KSocketDevice, KNetwork::KSocksSocketDevice, and KNetwork::KStreamSocket.
|
|
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 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.
Implemented in KNetwork::KClientSocketBase, KNetwork::KDatagramSocket, KNetwork::KHttpProxySocketDevice, KNetwork::KMulticastSocketImpl, KNetwork::KSocketDevice, KNetwork::KSocksSocketDevice, and KNetwork::KStreamSocket.
|
|
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.
Implemented in KNetwork::KClientSocketBase, and KNetwork::KSocketDevice.
|
|
This call is not supported on sockets. Reimplemented from QIODevice. This will always return 0. Definition at line 504 of file ksocketbase.h. |
|
This call is not supported on sockets. Reimplemented from QIODevice. This will always return 0. Definition at line 511 of file ksocketbase.h. |
|
This call is not supported on sockets. Reimplemented from QIODevice. This will always return false. Definition at line 518 of file ksocketbase.h. |
|
This call is not supported on sockets. Reimplemented from QIODevice. This will always return true. Definition at line 525 of file ksocketbase.h. |
|
Returns the number of bytes available for reading without blocking.
Implemented in KNetwork::KBufferedSocket, KNetwork::KClientSocketBase, and KNetwork::KSocketDevice.
|
|
Waits up to If msecs is -1, this call will block indefinetely until more data is indeed available; if it's 0, this function returns immediately.
If
Implemented in KNetwork::KBufferedSocket, KNetwork::KClientSocketBase, and KNetwork::KSocketDevice.
|
|
Reads data from the socket. Reimplemented from QIODevice. See QIODevice::readBlock for more information. Implemented in KNetwork::KBufferedSocket, KNetwork::KClientSocketBase, KNetwork::KSocketDevice, and KNetwork::KSocksSocketDevice.
Referenced by getch(). |
|
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
Implemented in KNetwork::KBufferedSocket, KNetwork::KClientSocketBase, KNetwork::KSocketDevice, and KNetwork::KSocksSocketDevice.
|
|
Peeks the data in the socket. 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.
Implemented in KNetwork::KBufferedSocket, KNetwork::KClientSocketBase, KNetwork::KSocketDevice, and KNetwork::KSocksSocketDevice.
|
|
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.
Implemented in KNetwork::KBufferedSocket, KNetwork::KClientSocketBase, KNetwork::KSocketDevice, and KNetwork::KSocksSocketDevice.
|
|
Writes the given data to the socket. Reimplemented from QIODevice. See QIODevice::writeBlock for more information. Implemented in KNetwork::KBufferedSocket, KNetwork::KClientSocketBase, KNetwork::KSocketDevice, and KNetwork::KSocksSocketDevice.
Referenced by putch(). |
|
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.
Implemented in KNetwork::KBufferedSocket, KNetwork::KClientSocketBase, KNetwork::KSocketDevice, and KNetwork::KSocksSocketDevice.
|
|
Reads one character from the socket. Reimplementation from QIODevice. See QIODevice::getch for more information. Definition at line 284 of file ksocketbase.cpp. References readBlock(). |
|
Writes one character to the socket. Reimplementation from QIODevice. See QIODevice::putch for more information. Definition at line 293 of file ksocketbase.cpp. References writeBlock(). |
|
This call is not supported on sockets. Reimplemented from QIODevice. This will always return -1; Definition at line 632 of file ksocketbase.h. |
|
Returns this socket's local address.
Implemented in KNetwork::KClientSocketBase, KNetwork::KSocketDevice, and KNetwork::KSocksSocketDevice.
|
|
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::KHttpProxySocketDevice, KNetwork::KSocketDevice, and KNetwork::KSocksSocketDevice.
|
|
|
Resets the socket error code and the I/O Device's status. Definition at line 308 of file ksocketbase.cpp. References KNetwork::KSocketBase::setError(). Referenced by KNetwork::KSocksSocketDevice::bind(), KNetwork::KSocketDevice::bind(), KNetwork::KClientSocketBase::bind(), KNetwork::KSocketDevice::close(), KNetwork::KSocksSocketDevice::connect(), KNetwork::KSocketDevice::connect(), KNetwork::KHttpProxySocketDevice::connect(), KNetwork::KSocketDevice::create(), KNetwork::KSocketDevice::disconnect(), KNetwork::KSocksSocketDevice::listen(), KNetwork::KSocketDevice::listen(), KNetwork::KSocketDevice::open(), KNetwork::KSocksSocketDevice::peekBlock(), KNetwork::KSocketDevice::peekBlock(), KNetwork::KBufferedSocket::peekBlock(), KNetwork::KSocksSocketDevice::poll(), KNetwork::KSocketDevice::poll(), KNetwork::KSocksSocketDevice::readBlock(), KNetwork::KSocketDevice::readBlock(), KNetwork::KBufferedSocket::readBlock(), KNetwork::KBufferedSocket::slotReadActivity(), KNetwork::KBufferedSocket::slotWriteActivity(), KNetwork::KBufferedSocket::waitForMore(), KNetwork::KSocksSocketDevice::writeBlock(), KNetwork::KSocketDevice::writeBlock(), and KNetwork::KBufferedSocket::writeBlock(). |
The documentation for this class was generated from the following files: