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

KDECore

  • 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
32namespace KNetwork {
33
34class KStreamSocket;
35class KResolver;
36class KResolverResults;
37
38class KServerSocketPrivate;
108class KDECORE_EXPORT_DEPRECATED KServerSocket: public QObject, public KPassiveSocketBase
109{
110 Q_OBJECT
111public:
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
169protected:
173 virtual bool setSocketOptions(int opts);
174
175public:
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
371private Q_SLOTS:
372 void lookupFinishedSlot();
373
374Q_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
408protected:
413 void copyError();
414
415private:
416 bool doBind();
417 bool doListen();
418
419private:
420 KServerSocket(const KServerSocket&);
421 KServerSocket& operator=(const KServerSocket&);
422
423 KServerSocketPrivate* const d;
424};
425
426} // namespace KNetwork
427
428#endif
KNetwork::KPassiveSocketBase
Abstract base class for passive sockets.
Definition: k3socketbase.h:775
KNetwork::KResolverEntry
One resolution entry.
Definition: k3resolver.h:69
KNetwork::KResolverResults
Name and service resolution results.
Definition: k3resolver.h:213
KNetwork::KResolver
Name and service resolution class.
Definition: k3resolver.h:313
KNetwork::KServerSocket
A server socket for accepting connections.
Definition: k3serversocket.h:109
KNetwork::KServerSocket::closed
void closed()
This signal is emitted when the socket completes the closing/shut down process.
KNetwork::KServerSocket::readyAccept
void readyAccept()
This signal is emitted whenever the socket is ready for accepting – i.e., there is at least one conne...
KNetwork::KServerSocket::hostFound
void hostFound()
This signal is emitted when the lookup is successfully completed.
KNetwork::KServerSocket::bound
void bound(const KNetwork::KResolverEntry &local)
This signal is emitted when the socket successfully binds to an address.
KNetwork::KServerSocket::gotError
void gotError(int code)
This signal is emitted when this object finds an error.
KNetwork::KSocketAddress
A generic socket address.
Definition: k3socketaddress.h:415
KNetwork::KStreamSocket
Simple stream socket.
Definition: k3streamsocket.h:99
QObject
QString
k3socketbase.h
k3streamsocket.h
lookup
static QByteArray lookup(const KConfigIniBackend::BufferFragment &fragment, QHash< KConfigIniBackend::BufferFragment, QByteArray > *cache)
Definition: kconfigini.cpp:43
KNetwork
A namespace to store all networking-related (socket) classes.
Definition: k3bufferedsocket.h:35
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
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