kdecore Library API Documentation

kstreamsocket.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 KSTREAMSOCKET_H
00026 #define KSTREAMSOCKET_H
00027 
00028 #include <qstring.h>
00029 
00030 #include "kclientsocketbase.h"
00031 
00032 namespace KNetwork {
00033 
00034 class KResolverEntry;
00035 class KResolverResults;
00036 class KServerSocket;
00037 
00038 class KStreamSocketPrivate;
00088 class KStreamSocket: public KClientSocketBase
00089 {
00090   Q_OBJECT
00091 
00092 public:
00101   KStreamSocket(const QString& node = QString::null, const QString& service = QString::null,
00102         QObject* parent = 0L, const char *name = 0L);
00103 
00107   virtual ~KStreamSocket();
00108 
00112   int timeout() const;
00113 
00118   int remainingTimeout() const;
00119 
00130   void setTimeout(int msecs);
00131 
00155   virtual bool bind(const QString& node = QString::null,
00156             const QString& service = QString::null);
00157 
00166   virtual bool bind(const KResolverEntry& entry)
00167   { return KClientSocketBase::bind(entry); }
00168 
00190   virtual bool connect(const QString& node = QString::null,
00191                const QString& service = QString::null);
00192 
00196   virtual bool connect(const KResolverEntry& entry);
00197 
00198 signals:
00202   void timedOut();
00203 
00204 private slots:
00205   void hostFoundSlot();
00206   void connectionEvent();
00207   void timeoutSlot();
00208 
00209 private:
00217   bool bindLocallyFor(const KResolverEntry& peer);
00218 
00227   void connectionSucceeded(const KResolverEntry& peer);
00228 
00229   KStreamSocket(const KStreamSocket&);
00230   KStreamSocket& operator=(const KStreamSocket&);
00231 
00232   KStreamSocketPrivate *d;
00233 
00234   friend class KServerSocket;
00235 };
00236 
00237 }               // namespace KNetwork
00238 
00239 #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:23 2004 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003