⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qsocketdevice.3qt

📁 qt专门用于嵌入式的图形开发GUI
💻 3QT
📖 第 1 页 / 共 2 页
字号:
'\" t.TH QSocketDevice 3qt "2 September 2005" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS.  All rights reserved.  See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQSocketDevice \- Platform-independent low-level socket API.SH SYNOPSIS\fC#include <qsocketdevice.h>\fR.PPInherits QIODevice..PP.SS "Public Members".in +1c.ti -1c.BI "enum \fBType\fR { Stream, Datagram }".br.ti -1c.BI "enum \fBProtocol\fR { IPv4, IPv6, Unknown }".br.ti -1c.BI "\fBQSocketDevice\fR ( Type type = Stream )".br.ti -1c.BI "\fBQSocketDevice\fR ( Type type, Protocol protocol, int dummy )".br.ti -1c.BI "\fBQSocketDevice\fR ( int socket, Type type )".br.ti -1c.BI "virtual \fB~QSocketDevice\fR ()".br.ti -1c.BI "bool \fBisValid\fR () const".br.ti -1c.BI "Type \fBtype\fR () const".br.ti -1c.BI "Protocol \fBprotocol\fR () const".br.ti -1c.BI "int \fBsocket\fR () const".br.ti -1c.BI "virtual void \fBsetSocket\fR ( int socket, Type type )".br.ti -1c.BI "bool \fBblocking\fR () const".br.ti -1c.BI "virtual void \fBsetBlocking\fR ( bool enable )".br.ti -1c.BI "bool \fBaddressReusable\fR () const".br.ti -1c.BI "virtual void \fBsetAddressReusable\fR ( bool enable )".br.ti -1c.BI "int \fBreceiveBufferSize\fR () const".br.ti -1c.BI "virtual void \fBsetReceiveBufferSize\fR ( uint size )".br.ti -1c.BI "int \fBsendBufferSize\fR () const".br.ti -1c.BI "virtual void \fBsetSendBufferSize\fR ( uint size )".br.ti -1c.BI "virtual bool \fBconnect\fR ( const QHostAddress & addr, Q_UINT16 port )".br.ti -1c.BI "virtual bool \fBbind\fR ( const QHostAddress & address, Q_UINT16 port )".br.ti -1c.BI "virtual bool \fBlisten\fR ( int backlog )".br.ti -1c.BI "virtual int \fBaccept\fR ()".br.ti -1c.BI "Q_LONG \fBbytesAvailable\fR () const".br.ti -1c.BI "Q_LONG \fBwaitForMore\fR ( int msecs, bool * timeout = 0 ) const".br.ti -1c.BI "virtual Q_LONG \fBreadBlock\fR ( char * data, Q_ULONG maxlen )".br.ti -1c.BI "virtual Q_LONG \fBwriteBlock\fR ( const char * data, Q_ULONG len )".br.ti -1c.BI "virtual Q_LONG \fBwriteBlock\fR ( const char * data, Q_ULONG len, const QHostAddress & host, Q_UINT16 port )".br.ti -1c.BI "Q_UINT16 \fBport\fR () const".br.ti -1c.BI "Q_UINT16 \fBpeerPort\fR () const".br.ti -1c.BI "QHostAddress \fBaddress\fR () const".br.ti -1c.BI "QHostAddress \fBpeerAddress\fR () const".br.ti -1c.BI "enum \fBError\fR { NoError, AlreadyBound, Inaccessible, NoResources, InternalError, Bug = InternalError, Impossible, NoFiles, ConnectionRefused, NetworkFailure, UnknownError }".br.ti -1c.BI "Error \fBerror\fR () const".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "void \fBsetError\fR ( Error err )".br.in -1c.SH DESCRIPTIONThe QSocketDevice class provides a platform-independent low-level socket API..PPThis class provides a low level API for working with sockets. Users of this class are assumed to have networking experience. For most users the QSocket class provides a much easier and high level alternative, but certain things (like UDP) can't be done with QSocket and if you need a platform-independent API for those, QSocketDevice is the right choice..PPThe essential purpose of the class is to provide a QIODevice that works on sockets, wrapped in a platform-independent API..PPWhen calling connect() or bind(), QSocketDevice detects the protocol family (IPv4, IPv6) automatically. Passing the protocol family to QSocketDevice's constructor or to setSocket() forces creation of a socket device of a specific protocol. If not set, the protocol will be detected at the first call to connect() or bind()..PPSee also QSocket, QSocketNotifier, QHostAddress, and Input/Output and Networking..SS "Member Type Documentation".SH "QSocketDevice::Error"This enum type describes the error states of QSocketDevice..TP\fCQSocketDevice::NoError\fR - No error has occurred..TP\fCQSocketDevice::AlreadyBound\fR - The device is already bound, according to bind()..TP\fCQSocketDevice::Inaccessible\fR - The operating system or firewall prohibited the action..TP\fCQSocketDevice::NoResources\fR - The operating system ran out of a resource..TP\fCQSocketDevice::InternalError\fR - An internal error occurred in QSocketDevice..TP\fCQSocketDevice::Impossible\fR - An attempt was made to do something which makes no sense. For example:.IP.nf.br    ::close( sd->socket() );.br    sd->writeBlock( someData, 42 );.br.fiThe libc ::close() closes the socket, but QSocketDevice is not aware of this. So when you call writeBlock(), the impossible happens..TP\fCQSocketDevice::NoFiles\fR - The operating system will not let QSocketDevice open another file..TP\fCQSocketDevice::ConnectionRefused\fR - A connection attempt was rejected by the peer..TP\fCQSocketDevice::NetworkFailure\fR - There is a network failure..TP\fCQSocketDevice::UnknownError\fR - The operating system did something unexpected..SH "QSocketDevice::Protocol"This enum type describes the protocol family of the socket. Possible values are:.TP\fCQSocketDevice::IPv4\fR - The socket is an IPv4 socket..TP\fCQSocketDevice::IPv6\fR - The socket is an IPv6 socket..TP\fCQSocketDevice::Unknown\fR - The protocol family of the socket is not known. This can happen if you use QSocketDevice with an already existing socket; it tries to determine the protocol family, but this can fail if the protocol family is not known to QSocketDevice..PPSee also protocol() and setSocket()..SH "QSocketDevice::Type"This enum type describes the type of the socket:.TP\fCQSocketDevice::Stream\fR - a stream socket (TCP, usually).TP\fCQSocketDevice::Datagram\fR - a datagram socket (UDP, usually).SH MEMBER FUNCTION DOCUMENTATION.SH "QSocketDevice::QSocketDevice ( Type type = Stream )"Creates a QSocketDevice object for a stream or datagram socket.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -