KDECore
kserversocket.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef KSERVERSOCKET_H
00026 #define KSERVERSOCKET_H
00027
00028 #include <qobject.h>
00029 #include "ksocketbase.h"
00030
00031 namespace KNetwork {
00032
00033 class KSocketDevice;
00034 class KStreamSocket;
00035 class KResolver;
00036 class KResolverResults;
00037
00038 class KServerSocketPrivate;
00107 class KDECORE_EXPORT KServerSocket: public QObject, public KPassiveSocketBase
00108 {
00109 Q_OBJECT
00110 public:
00121 KServerSocket(QObject* parent = 0L, const char *name = 0L);
00122
00140 KServerSocket(const QString& service, QObject* parent = 0L, const char *name = 0L);
00141
00160 KServerSocket(const QString& node, const QString& service,
00161 QObject* parent = 0L, const char *name = 0L);
00162
00169 ~KServerSocket();
00170
00171 protected:
00175 virtual bool setSocketOptions(int opts);
00176
00177 public:
00186 KResolver& resolver() const;
00187
00191 const KResolverResults& resolverResults() const;
00192
00207 void setResolutionEnabled(bool enable);
00208
00215 void setFamily(int families);
00216
00230 void setAddress(const QString& service);
00231
00247 void setAddress(const QString& node, const QString& service);
00248
00256 void setTimeout(int msecs);
00257
00275 virtual bool lookup();
00276
00290 virtual bool bind(const QString& node, const QString& service);
00291
00298 virtual bool bind(const QString& service);
00299
00305 virtual bool bind();
00306
00314 virtual bool bind(const KResolverEntry& address);
00315
00329 virtual bool listen(int backlog = 5);
00330
00334 virtual void close();
00335
00347 void setAcceptBuffered(bool enable);
00348
00366 virtual KActiveSocketBase* accept();
00367
00371 virtual KSocketAddress localAddress() const;
00372
00376 virtual KSocketAddress externalAddress() const;
00377
00378 private slots:
00379 void lookupFinishedSlot();
00380
00381 signals:
00387 void gotError(int code);
00388
00392 void hostFound();
00393
00400 void bound(const KResolverEntry& local);
00401
00406 void closed();
00407
00413 void readyAccept();
00414
00415 protected:
00420 void copyError();
00421
00422 private:
00423 bool doBind();
00424 bool doListen();
00425
00426 private:
00427 KServerSocket(const KServerSocket&);
00428 KServerSocket& operator=(const KServerSocket&);
00429
00430 KServerSocketPrivate *d;
00431 };
00432
00433 }
00434
00435 #endif