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; 00097 class KDECORE_EXPORT KServerSocket: public QObject, public KPassiveSocketBase 00098 { 00099 Q_OBJECT 00100 public: 00111 KServerSocket(QObject* parent = 0L, const char *name = 0L); 00112 00130 KServerSocket(const QString& service, QObject* parent = 0L, const char *name = 0L); 00131 00150 KServerSocket(const QString& node, const QString& service, 00151 QObject* parent = 0L, const char *name = 0L); 00152 00159 ~KServerSocket(); 00160 00161 protected: 00165 virtual bool setSocketOptions(int opts); 00166 00167 public: 00176 KResolver& resolver() const; 00177 00181 const KResolverResults& resolverResults() const; 00182 00197 void setResolutionEnabled(bool enable); 00198 00205 void setFamily(int families); 00206 00220 void setAddress(const QString& service); 00221 00237 void setAddress(const QString& node, const QString& service); 00238 00246 void setTimeout(int msecs); 00247 00265 virtual bool lookup(); 00266 00280 virtual bool bind(const QString& node, const QString& service); 00281 00288 virtual bool bind(const QString& service); 00289 00295 virtual bool bind(); 00296 00304 virtual bool bind(const KResolverEntry& address); 00305 00319 virtual bool listen(int backlog = 5); // 5 is arbitrary 00320 00324 virtual void close(); 00325 00337 void setAcceptBuffered(bool enable); 00338 00356 virtual KActiveSocketBase* accept(); 00357 00361 virtual KSocketAddress localAddress() const; 00362 00366 virtual KSocketAddress externalAddress() const; 00367 00368 private slots: 00369 void lookupFinishedSlot(); 00370 00371 signals: 00377 void gotError(int code); 00378 00382 void hostFound(); 00383 00390 void bound(const KResolverEntry& local); 00391 00396 void closed(); 00397 00403 void readyAccept(); 00404 00405 protected: 00410 void copyError(); 00411 00412 private: 00413 bool doBind(); 00414 bool doListen(); 00415 00416 private: 00417 KServerSocket(const KServerSocket&); 00418 KServerSocket& operator=(const KServerSocket&); 00419 00420 KServerSocketPrivate *d; 00421 }; 00422 00423 } // namespace KNetwork 00424 00425 #endif
KDE Logo
This file is part of the documentation for kdecore Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Apr 14 00:03:32 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003