• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • sources
  • kde-4.14
  • kdelibs
  • kdecore
  • network
k3serversocket.h
Go to the documentation of this file.
1 /* -*- C++ -*-
2  * Copyright (C) 2003,2005 Thiago Macieira <thiago@kde.org>
3  *
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 #ifndef KSERVERSOCKET_H
26 #define KSERVERSOCKET_H
27 
28 #include <QtCore/QObject>
29 #include "k3socketbase.h"
30 #include "k3streamsocket.h"
31 
32 namespace KNetwork {
33 
34 class KStreamSocket;
35 class KResolver;
36 class KResolverResults;
37 
38 class KServerSocketPrivate;
108 class KDECORE_EXPORT_DEPRECATED KServerSocket: public QObject, public KPassiveSocketBase
109 {
110  Q_OBJECT
111 public:
121  KServerSocket(QObject* parent = 0L);
122 
139  explicit KServerSocket(const QString& service, QObject* parent = 0L);
140 
158  KServerSocket(const QString& node, const QString& service,
159  QObject* parent = 0L);
160 
167  ~KServerSocket();
168 
169 protected:
173  virtual bool setSocketOptions(int opts);
174 
175 public:
184  KResolver& resolver() const;
185 
189  const KResolverResults& resolverResults() const;
190 
205  void setResolutionEnabled(bool enable);
206 
213  void setFamily(int families);
214 
228  void setAddress(const QString& service);
229 
245  void setAddress(const QString& node, const QString& service);
246 
254  void setTimeout(int msecs);
255 
273  virtual bool lookup();
274 
288  virtual bool bind(const QString& node, const QString& service);
289 
296  virtual bool bind(const QString& service);
297 
303  virtual bool bind();
304 
312  virtual bool bind(const KResolverEntry& address);
313 
327  virtual bool listen(int backlog = 5); // 5 is arbitrary
328 
332  virtual void close();
333 
345  void setAcceptBuffered(bool enable);
346 
359  virtual KStreamSocket* accept();
360 
364  virtual KSocketAddress localAddress() const;
365 
369  virtual KSocketAddress externalAddress() const;
370 
371 private Q_SLOTS:
372  void lookupFinishedSlot();
373 
374 Q_SIGNALS:
380  void gotError(int code);
381 
385  void hostFound();
386 
393  void bound(const KNetwork::KResolverEntry& local);
394 
399  void closed();
400 
406  void readyAccept();
407 
408 protected:
413  void copyError();
414 
415 private:
416  bool doBind();
417  bool doListen();
418 
419 private:
420  KServerSocket(const KServerSocket&);
421  KServerSocket& operator=(const KServerSocket&);
422 
423  KServerSocketPrivate* const d;
424 };
425 
426 } // namespace KNetwork
427 
428 #endif
KNetwork::KStreamSocket
Simple stream socket.
Definition: k3streamsocket.h:98
KNetwork::KServerSocket
A server socket for accepting connections.
Definition: k3serversocket.h:108
KNetwork::KResolverEntry
One resolution entry.
Definition: k3resolver.h:68
KNetwork::KResolver
Name and service resolution class.
Definition: k3resolver.h:312
KSocketFactory::listen
QTcpServer * listen(const QString &protocol, const QHostAddress &address=QHostAddress::Any, quint16 port=0, QObject *parent=0)
Opens a TCP/IP socket for listening protocol protocol, binding only at address address.
Definition: ksocketfactory.cpp:115
KNetwork::KSocketAddress
A generic socket address.
Definition: k3socketaddress.h:414
k3streamsocket.h
KNetwork::KResolverResults
Name and service resolution results.
Definition: k3resolver.h:212
QObject
QString
k3socketbase.h
lookup
static QByteArray lookup(const KConfigIniBackend::BufferFragment &fragment, QHash< KConfigIniBackend::BufferFragment, QByteArray > *cache)
Definition: kconfigini.cpp:43
KNetwork::KPassiveSocketBase
Abstract base class for passive sockets.
Definition: k3socketbase.h:774
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal