kdecore Library API Documentation

kserversocket.h

00001 /*  -*- C++ -*-
00002  *  Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net>
00003  *
00004  *
00005  *  Permission is hereby granted, free of charge, to any person obtaining
00006  *  a copy of this software and associated documentation files (the
00007  *  "Software"), to deal in the Software without restriction, including
00008  *  without limitation the rights to use, copy, modify, merge, publish,
00009  *  distribute, sublicense, and/or sell copies of the Software, and to
00010  *  permit persons to whom the Software is furnished to do so, subject to
00011  *  the following conditions:
00012  *
00013  *  The above copyright notice and this permission notice shall be included 
00014  *  in all copies or substantial portions of the Software.
00015  *
00016  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00017  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00018  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00019  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00020  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00021  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00022  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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;
00063 class KServerSocket: public QObject, public KPassiveSocketBase
00064 {
00065   Q_OBJECT
00066 public:
00077   KServerSocket(QObject* parent = 0L, const char *name = 0L);
00078 
00090   KServerSocket(const QString& service, QObject* parent = 0L, const char *name = 0L);
00091 
00104   KServerSocket(const QString& node, const QString& service,
00105         QObject* parent = 0L, const char *name = 0L);
00106 
00113   ~KServerSocket();
00114 
00115 protected:
00119   virtual bool setSocketOptions(int opts);
00120 
00121 public:
00130   KResolver& resolver() const;
00131 
00135   const KResolverResults& resolverResults() const;
00136 
00151   void setResolutionEnabled(bool enable);
00152 
00159   void setFamily(int families);
00160 
00168   void setAddress(const QString& service);
00169 
00178   void setAddress(const QString& node, const QString& service);
00179 
00187   void setTimeout(int msecs);
00188 
00206   virtual bool lookup();
00207 
00221   virtual bool bind(const QString& node, const QString& service);
00222 
00229   virtual bool bind(const QString& service);
00230 
00236   virtual bool bind();
00237 
00245   virtual bool bind(const KResolverEntry& address);
00246 
00260   virtual bool listen(int backlog = 5); // 5 is arbitrary
00261 
00265   virtual void close();
00266 
00278   void setAcceptBuffered(bool enable);
00279 
00297   virtual KActiveSocketBase* accept();
00298 
00302   virtual KSocketAddress localAddress() const;
00303 
00307   virtual KSocketAddress externalAddress() const;
00308 
00309 private slots:
00310   void lookupFinishedSlot();
00311 
00312 signals:
00318   void gotError(int code);
00319 
00323   void hostFound();
00324 
00331   void bound(const KResolverEntry& local);
00332 
00337   void closed();
00338 
00344   void readyAccept();
00345 
00346 protected:
00351   void copyError();
00352 
00353 private:
00354   bool doBind();
00355 
00356 private:
00357   KServerSocket(const KServerSocket&);
00358   KServerSocket& operator=(const KServerSocket&);
00359 
00360   KServerSocketPrivate *d;
00361 };
00362 
00363 }               // namespace KNetwork
00364 
00365 #endif
KDE Logo
This file is part of the documentation for kdecore Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Nov 27 13:41:19 2004 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003