25 #ifndef KCLIENTSOCKETBASE_H
26 #define KCLIENTSOCKETBASE_H
31 #include "tdesocketbase.h"
32 #include "kresolver.h"
33 #include <tdelibs_export.h>
41 class KClientSocketBasePrivate;
114 SocketState state()
const;
120 virtual bool setSocketOptions(
int opts);
167 void setResolutionEnabled(
bool enable);
175 void setFamily(
int families);
194 virtual bool lookup();
215 virtual bool bind(
const TQString& node = TQString::null,
216 const TQString& service = TQString::null) = 0;
256 virtual bool connect(
const TQString& node = TQString::null,
257 const TQString& service = TQString::null) = 0;
271 { connect(host, TQString::number(port)); }
277 virtual bool disconnect();
284 virtual inline bool open(TQ_OpenMode)
285 {
return connect(); }
293 virtual void close();
306 virtual TQ_LONG bytesAvailable()
const;
309 virtual qint64 bytesAvailable()
const;
315 virtual TQ_LONG waitForMore(
int msecs,
bool *timeout = 0L);
320 virtual TQT_TQIO_LONG tqreadBlock(
char *data, TQT_TQIO_ULONG maxlen);
326 virtual TQT_TQIO_LONG tqreadBlock(
char *data, TQT_TQIO_ULONG maxlen,
TDESocketAddress& from);
331 virtual TQ_LONG peekBlock(
char *data, TQ_ULONG maxlen);
337 virtual TQ_LONG peekBlock(
char *data, TQ_ULONG maxlen,
TDESocketAddress &from);
342 virtual TQT_TQIO_LONG tqwriteBlock(
const char *data, TQT_TQIO_ULONG len);
348 virtual TQT_TQIO_LONG tqwriteBlock(
const char *data, TQT_TQIO_ULONG len,
const TDESocketAddress& to);
363 bool emitsReadyRead()
const;
371 virtual void enableRead(
bool enable);
376 bool emitsReadyWrite()
const;
384 virtual void enableWrite(
bool enable);
398 virtual void slotReadActivity();
409 virtual void slotWriteActivity();
412 void lookupFinishedSlot();
423 void stateChanged(
int newstate);
430 void gotError(
int code);
504 void setState(SocketState state);
515 virtual void stateChanging(SocketState newState);
527 KClientSocketBasePrivate *d;
A generic socket address.
Abstract class for active sockets.
virtual void flush()
This call is not supported on sockets.
Name and service resolution class.
void connectToHost(const TQString &host, TQ_UINT16 port)
Name and service resolution results.
A namespace to store all networking-related (socket) classes.
SocketState
Socket states.
virtual bool open(TQ_OpenMode)
Opens the socket.
Abstract client socket class.