KDELibs4Support

k3streamsocket.h
1 /* -*- C++ -*-
2  * Copyright (C) 2003,2005 Thiago Macieira <[email protected]>
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 KSTREAMSOCKET_H
26 #define KSTREAMSOCKET_H
27 
28 #include <QString>
29 
30 #include "k3clientsocketbase.h"
31 
33 namespace KNetwork
34 {
35 
36 class KResolverEntry;
37 class KServerSocket;
38 class KBufferedSocket;
39 
40 class KStreamSocketPrivate;
99 class KDELIBS4SUPPORT_DEPRECATED_EXPORT KStreamSocket: public KClientSocketBase
100 {
101  Q_OBJECT
102 
103 public:
111  KDELIBS4SUPPORT_DEPRECATED explicit KStreamSocket(const QString &node = QString(), const QString &service = QString(),
112  QObject *parent = nullptr);
113 
117  virtual ~KStreamSocket();
118 
122  int timeout() const;
123 
128  int remainingTimeout() const;
129 
140  void setTimeout(int msecs);
141 
165  virtual bool bind(const QString &node = QString(),
166  const QString &service = QString()) override;
167 
176  bool bind(const KResolverEntry &entry) override;
177 
200  virtual bool connect(const QString &node = QString(),
201  const QString &service = QString(),
202  OpenMode mode = ReadWrite) override;
203 
207  virtual bool connect(const KResolverEntry &entry,
208  OpenMode mode = ReadWrite) override;
209 
210 Q_SIGNALS:
214  void timedOut();
215 
216 private Q_SLOTS:
217  void hostFoundSlot();
218  void connectionEvent();
219  void timeoutSlot();
220 
221 private:
229  bool bindLocallyFor(const KResolverEntry &peer);
230 
239  void connectionSucceeded(const KResolverEntry &peer);
240 
241  KStreamSocket(const KStreamSocket &);
242  KStreamSocket &operator=(const KStreamSocket &);
243 
244  KStreamSocketPrivate *const d;
245 
246  friend class KServerSocket;
247  friend class KBufferedSocket;
248 };
249 
250 } // namespace KNetwork
251 
252 #endif
Simple stream socket.
A server socket for accepting connections.
One resolution entry.
Definition: k3resolver.h:72
A namespace to store all networking-related (socket) classes.
Buffered stream sockets.
Abstract client socket class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Nov 30 2020 22:59:23 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.