• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

  • tdecore
  • network
kbufferedsocket.h
1 /*
2  * Copyright (C) 2003 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 KBUFFEREDSOCKET_H
26 #define KBUFFEREDSOCKET_H
27 
28 #include <tqobject.h>
29 #include <tqcstring.h>
30 #include <tqvaluelist.h>
31 #include "kstreamsocket.h"
32 #include <tdelibs_export.h>
33 
34 class TDEIOBufferBase;
35 
36 namespace KNetwork {
37 
38 class TDEBufferedSocketPrivate;
58 class TDECORE_EXPORT TDEBufferedSocket: public KStreamSocket
59 {
60  TQ_OBJECT
61 
62 public:
71  TDEBufferedSocket(const TQString& node = TQString::null, const TQString& service = TQString::null,
72  TQObject* parent = 0L, const char *name = 0L);
73 
77  virtual ~TDEBufferedSocket();
78 
82  virtual void setSocketDevice(TDESocketDevice* device);
83 
84 protected:
88  virtual bool setSocketOptions(int opts);
89 
90 public:
97  virtual void close();
98 
102  virtual TQ_LONG bytesAvailable() const;
103 
107  virtual TQ_LONG waitForMore(int msecs, bool *timeout = 0L);
108 
112  virtual TQ_LONG readBlock(char *data, TQ_ULONG maxlen);
113 
120  virtual TQ_LONG readBlock(char *data, TQ_ULONG maxlen, TDESocketAddress& from);
121 
125  virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen);
126 
133  virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen, TDESocketAddress &from);
134 
138  virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len);
139 
146  virtual TQ_LONG writeBlock(const char *data, TQ_ULONG len, const TDESocketAddress& to);
147 
151  virtual void enableRead(bool enable);
152 
156  virtual void enableWrite(bool enable);
157 
161  void setInputBuffering(bool enable);
162 
166  TDEIOBufferBase* inputBuffer();
167 
171  void setOutputBuffering(bool enable);
172 
176  TDEIOBufferBase* outputBuffer();
177 
181  virtual TQ_ULONG bytesToWrite() const;
182 
189  virtual void closeNow();
190 
194  bool canReadLine() const;
195 
199  TQCString readLine();
200 
205  void waitForConnect();
206 
207 protected:
211  virtual void stateChanging(SocketState newState);
212 
213 protected slots:
217  virtual void slotReadActivity();
218 
222  virtual void slotWriteActivity();
223 
224 signals:
228  void bytesWritten(int bytes);
229 
230 private:
231  TDEBufferedSocket(const TDEBufferedSocket&);
232  TDEBufferedSocket& operator=(const TDEBufferedSocket&);
233 
234  TDEBufferedSocketPrivate *d;
235 
236 public:
237  // KDE4: remove this function
246  inline void reset()
247  { closeNow(); }
248 };
249 
250 } // namespace KNetwork
251 
252 #endif
KNetwork::KClientSocketBase::SocketState
SocketState
Socket states.
Definition: kclientsocketbase.h:73
KNetwork::KStreamSocket
Simple stream socket.
Definition: kstreamsocket.h:98
KNetwork::TDEBufferedSocket
Buffered stream sockets.
Definition: kbufferedsocket.h:59
KNetwork::TDEBufferedSocket::bytesWritten
void bytesWritten(int bytes)
This signal is emitted whenever data is written.
KNetwork::TDEBufferedSocket::reset
void reset()
Definition: kbufferedsocket.h:246
KNetwork::TDESocketAddress
A generic socket address.
Definition: tdesocketaddress.h:424
KNetwork::TDESocketDevice
Low-level socket functionality.
Definition: tdesocketdevice.h:51
TDEIOBufferBase
base for I/O buffer implementation
Definition: tdeiobuffer.h:46
KNetwork
A namespace to store all networking-related (socket) classes.
Definition: kbufferedsocket.h:36

tdecore

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

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.1
This website is maintained by Timothy Pearson.