25 #ifndef KCLIENTSOCKETBASE_H
26 #define KCLIENTSOCKETBASE_H
31 #include "tdesocketbase.h"
32 #include "kresolver.h"
33 #include <tdelibs_export.h>
37 class KClientSocketBasePrivate;
105 SocketState state()
const;
111 virtual bool setSocketOptions(
int opts);
158 void setResolutionEnabled(
bool enable);
166 void setFamily(
int families);
185 virtual bool lookup();
206 virtual bool bind(
const TQString& node = TQString::null,
207 const TQString& service = TQString::null) = 0;
247 virtual bool connect(
const TQString& node = TQString::null,
248 const TQString& service = TQString::null) = 0;
262 { connect(host, TQString::number(port)); }
268 virtual bool disconnect();
276 {
return connect(); }
284 virtual void close();
296 virtual TQ_LONG bytesAvailable()
const;
301 virtual TQ_LONG waitForMore(
int msecs,
bool *timeout = 0L);
306 virtual TQ_LONG readBlock(
char *data, TQ_ULONG maxlen);
312 virtual TQ_LONG readBlock(
char *data, TQ_ULONG maxlen,
TDESocketAddress& from);
317 virtual TQ_LONG peekBlock(
char *data, TQ_ULONG maxlen);
323 virtual TQ_LONG peekBlock(
char *data, TQ_ULONG maxlen,
TDESocketAddress &from);
328 virtual TQ_LONG writeBlock(
const char *data, TQ_ULONG len);
334 virtual TQ_LONG writeBlock(
const char *data, TQ_ULONG len,
const TDESocketAddress& to);
349 bool emitsReadyRead()
const;
357 virtual void enableRead(
bool enable);
362 bool emitsReadyWrite()
const;
370 virtual void enableWrite(
bool enable);
384 virtual void slotReadActivity();
395 virtual void slotWriteActivity();
398 void lookupFinishedSlot();
513 KClientSocketBasePrivate *d;
Abstract class for active sockets.
Abstract client socket class.
void connected(const KResolverEntry &remote)
This socket is emitted when the socket successfully connects to a remote address.
virtual void flush()
This call is not supported on sockets.
SocketState
Socket states.
virtual bool open(int)
Opens the socket.
void readyRead()
This signal is emitted whenever the socket is ready for reading – i.e., there is data to be read in t...
void closed()
This signal is emitted when the socket completes the closing/shut down process.
void bound(const KResolverEntry &local)
This signal is emitted when the socket successfully binds to an address.
void readyWrite()
This signal is emitted whenever the socket is ready for writing – i.e., whenever there's space availa...
virtual bool bind(const TQString &node=TQString::null, const TQString &service=TQString::null)=0
Binds this socket to the given nodename and service, or use the default ones if none are given.
virtual bool connect(const TQString &node=TQString::null, const TQString &service=TQString::null)=0
Attempts to connect to the these hostname and service, or use the default ones if none are given.
void gotError(int code)
This signal is emitted when this object finds an error.
void aboutToConnect(const KResolverEntry &remote, bool &skip)
This signal is emitted when the socket is about to connect to an address (but before doing so).
void hostFound()
This signal is emitted when the lookup is successfully completed.
void connectToHost(const TQString &host, TQ_UINT16 port)
void stateChanged(int newstate)
This signal is emitted whenever the socket state changes.
Name and service resolution results.
Name and service resolution class.
A generic socket address.
A namespace to store all networking-related (socket) classes.