1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qsocketdevice.h:1 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>qsocketdevice.h Include File</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qsocketdevice.h</h1>
|
---|
33 |
|
---|
34 | <p>This is the verbatim text of the qsocketdevice.h include file. It is provided only for illustration; the copyright remains with Trolltech.
|
---|
35 | <hr>
|
---|
36 | <pre>
|
---|
37 | /****************************************************************************
|
---|
38 | ** $Id: qsocketdevice-h.html 2051 2007-02-21 10:04:20Z chehrlic $
|
---|
39 | **
|
---|
40 | ** Definition of QSocketDevice class.
|
---|
41 | **
|
---|
42 | ** Created : 970521
|
---|
43 | **
|
---|
44 | ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
|
---|
45 | **
|
---|
46 | ** This file is part of the network module of the Qt GUI Toolkit.
|
---|
47 | **
|
---|
48 | ** This file may be distributed under the terms of the Q Public License
|
---|
49 | ** as defined by Trolltech ASA of Norway and appearing in the file
|
---|
50 | ** LICENSE.QPL included in the packaging of this file.
|
---|
51 | **
|
---|
52 | ** This file may be distributed and/or modified under the terms of the
|
---|
53 | ** GNU General Public License version 2 as published by the Free Software
|
---|
54 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
55 | ** packaging of this file.
|
---|
56 | **
|
---|
57 | ** Licensees holding valid Qt Enterprise Edition licenses may use this
|
---|
58 | ** file in accordance with the Qt Commercial License Agreement provided
|
---|
59 | ** with the Software.
|
---|
60 | **
|
---|
61 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
62 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
63 | **
|
---|
64 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
65 | ** information about Qt Commercial License Agreements.
|
---|
66 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
67 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
68 | **
|
---|
69 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
70 | ** not clear to you.
|
---|
71 | **
|
---|
72 | **********************************************************************/
|
---|
73 |
|
---|
74 | #ifndef QSOCKETDEVICE_H
|
---|
75 | #define QSOCKETDEVICE_H
|
---|
76 |
|
---|
77 | #ifndef QT_H
|
---|
78 | #include "qiodevice.h"
|
---|
79 | #include "qhostaddress.h" // int->QHostAddress conversion
|
---|
80 | #endif // QT_H
|
---|
81 |
|
---|
82 | #if !defined( QT_MODULE_NETWORK ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_NETWORK )
|
---|
83 | #define QM_EXPORT_NETWORK
|
---|
84 | #else
|
---|
85 | #define QM_EXPORT_NETWORK Q_EXPORT
|
---|
86 | #endif
|
---|
87 |
|
---|
88 | #ifndef QT_NO_NETWORK
|
---|
89 | class QSocketDevicePrivate;
|
---|
90 |
|
---|
91 |
|
---|
92 | class QM_EXPORT_NETWORK QSocketDevice: public QIODevice
|
---|
93 | {
|
---|
94 | public:
|
---|
95 | enum Type { Stream, Datagram };
|
---|
96 | enum Protocol { IPv4, IPv6, Unknown };
|
---|
97 |
|
---|
98 | QSocketDevice( Type type = Stream );
|
---|
99 | QSocketDevice( Type type, Protocol protocol, int dummy );
|
---|
100 | QSocketDevice( int socket, Type type );
|
---|
101 | virtual ~QSocketDevice();
|
---|
102 |
|
---|
103 | bool isValid() const;
|
---|
104 | Type type() const;
|
---|
105 | Protocol protocol() const;
|
---|
106 |
|
---|
107 | int socket() const;
|
---|
108 | virtual void setSocket( int socket, Type type );
|
---|
109 |
|
---|
110 | bool open( int mode );
|
---|
111 | void close();
|
---|
112 | void flush();
|
---|
113 |
|
---|
114 | // Implementation of QIODevice abstract virtual functions
|
---|
115 | Offset size() const;
|
---|
116 | Offset at() const;
|
---|
117 | bool at( Offset );
|
---|
118 | bool atEnd() const;
|
---|
119 |
|
---|
120 | bool blocking() const;
|
---|
121 | virtual void setBlocking( bool );
|
---|
122 |
|
---|
123 | bool addressReusable() const;
|
---|
124 | virtual void setAddressReusable( bool );
|
---|
125 |
|
---|
126 | int receiveBufferSize() const;
|
---|
127 | virtual void setReceiveBufferSize( uint );
|
---|
128 | int sendBufferSize() const;
|
---|
129 | virtual void setSendBufferSize( uint );
|
---|
130 |
|
---|
131 | virtual bool connect( const QHostAddress &, Q_UINT16 );
|
---|
132 |
|
---|
133 | virtual bool bind( const QHostAddress &, Q_UINT16 );
|
---|
134 | virtual bool listen( int backlog );
|
---|
135 | virtual int accept();
|
---|
136 |
|
---|
137 | Q_LONG bytesAvailable() const;
|
---|
138 | Q_LONG waitForMore( int msecs, bool *timeout=0 ) const;
|
---|
139 | Q_LONG readBlock( char *data, Q_ULONG maxlen );
|
---|
140 | Q_LONG writeBlock( const char *data, Q_ULONG len );
|
---|
141 | virtual Q_LONG writeBlock( const char *data, Q_ULONG len,
|
---|
142 | const QHostAddress & host, Q_UINT16 port );
|
---|
143 |
|
---|
144 | int getch();
|
---|
145 | int putch( int );
|
---|
146 | int ungetch(int);
|
---|
147 |
|
---|
148 | Q_UINT16 port() const;
|
---|
149 | Q_UINT16 peerPort() const;
|
---|
150 | QHostAddress address() const;
|
---|
151 | QHostAddress peerAddress() const;
|
---|
152 |
|
---|
153 | enum Error {
|
---|
154 | NoError,
|
---|
155 | AlreadyBound,
|
---|
156 | Inaccessible,
|
---|
157 | NoResources,
|
---|
158 | InternalError,
|
---|
159 | Bug = InternalError, // ### remove in 4.0?
|
---|
160 | Impossible,
|
---|
161 | NoFiles,
|
---|
162 | ConnectionRefused,
|
---|
163 | NetworkFailure,
|
---|
164 | UnknownError
|
---|
165 | };
|
---|
166 | Error error() const;
|
---|
167 |
|
---|
168 | protected:
|
---|
169 | void setError( Error err );
|
---|
170 |
|
---|
171 | private:
|
---|
172 | int fd;
|
---|
173 | Type t;
|
---|
174 | Q_UINT16 p;
|
---|
175 | QHostAddress a;
|
---|
176 | Q_UINT16 pp;
|
---|
177 | QHostAddress pa;
|
---|
178 | QSocketDevice::Error e;
|
---|
179 | QSocketDevicePrivate * d;
|
---|
180 |
|
---|
181 | enum Option { Broadcast, ReceiveBuffer, ReuseAddress, SendBuffer };
|
---|
182 |
|
---|
183 | int option( Option ) const;
|
---|
184 | virtual void setOption( Option, int );
|
---|
185 |
|
---|
186 | void fetchConnectionParameters();
|
---|
187 | #if defined(Q_OS_WIN32)
|
---|
188 | void fetchPeerConnectionParameters();
|
---|
189 | #endif
|
---|
190 |
|
---|
191 | static void init();
|
---|
192 | int createNewSocket();
|
---|
193 | Protocol getProtocol() const;
|
---|
194 |
|
---|
195 | private: // Disabled copy constructor and operator=
|
---|
196 | #if defined(Q_DISABLE_COPY)
|
---|
197 | QSocketDevice( const QSocketDevice & );
|
---|
198 | QSocketDevice &operator=( const QSocketDevice & );
|
---|
199 | #endif
|
---|
200 | };
|
---|
201 |
|
---|
202 | #endif // QT_NO_NETWORK
|
---|
203 | #endif // QSOCKETDEVICE_H
|
---|
204 | </pre>
|
---|
205 | <!-- eof -->
|
---|
206 | <p><address><hr><div align=center>
|
---|
207 | <table width=100% cellspacing=0 border=0><tr>
|
---|
208 | <td>Copyright © 2007
|
---|
209 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
210 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
211 | </table></div></address></body>
|
---|
212 | </html>
|
---|