| qabstractsocket.cpp |
|
101161 |
- |
| qabstractsocket.h |
5 |
7772 |
- |
| qabstractsocket_p.h |
|
4821 |
- |
| qabstractsocketengine.cpp |
|
6295 |
- |
| qabstractsocketengine_p.h |
|
8047 |
- |
| qabstractsocketenginereceiver_p.h |
|
1253 |
- |
| qhttpsocketengine.cpp |
|
29140 |
- |
| qhttpsocketengine_p.h |
|
5857 |
- |
| qlocalserver.cpp |
!
\class QLocalServer
\since 4.4
\inmodule QtNetwork
\brief The QLocalServer class provides a local socket based server.
This class makes it possible to accept incoming local socket
connections.
Call listen() to have the server start listening
for incoming connections on a specified key. The
newConnection() signal is then emitted each time a client
connects to the server.
Call nextPendingConnection() to accept the pending connection
as a connected QLocalSocket. The function returns a pointer to a
QLocalSocket that can be used for communicating with the client.
If an error occurs, serverError() returns the type of error, and
errorString() can be called to get a human readable description
of what happened.
When listening for connections, the name which the server is
listening on is available through serverName().
Calling close() makes QLocalServer stop listening for incoming connections.
Although QLocalServer is designed for use with an event loop, it's possible
to use it without one. In that case, you must use waitForNewConnection(),
which blocks until either a connection is available or a timeout expires.
\sa QLocalSocket, QTcpServer
|
17055 |
- |
| qlocalserver.h |
|
2334 |
- |
| qlocalserver_p.h |
|
2618 |
- |
| qlocalserver_tcp.cpp |
|
2674 |
- |
| qlocalserver_unix.cpp |
|
10354 |
- |
| qlocalserver_win.cpp |
|
11900 |
- |
| qlocalsocket.cpp |
!
\class QLocalSocket
\since 4.4
\inmodule QtNetwork
\brief The QLocalSocket class provides a local socket.
On Windows this is a named pipe and on Unix this is a local domain socket.
If an error occurs, error() returns the type of error, and
errorString() can be called to get a human readable description
of what happened.
Although QLocalSocket is designed for use with an event loop, it's possible
to use it without one. In that case, you must use waitForConnected(),
waitForReadyRead(), waitForBytesWritten(), and waitForDisconnected()
which blocks until the operation is complete or the timeout expires.
\sa QLocalServer
|
15757 |
- |
| qlocalsocket.h |
|
4900 |
- |
| qlocalsocket_p.h |
|
4091 |
- |
| qlocalsocket_tcp.cpp |
|
13335 |
- |
| qlocalsocket_unix.cpp |
|
21707 |
- |
| qlocalsocket_win.cpp |
!
\internal
Waits until new data is available for reading or write operation
completes. Returns \c true, if we need to check pipe workers;
otherwise it returns \c false (if an error occurred or the operation
timed out).
\note If the read operation is inactive, it succeeds after
a short wait, allowing the caller to check the state of the socket.
|
16167 |
- |
| qnativesocketengine.cpp |
! \class QNativeSocketEngine
\internal
\brief The QNativeSocketEngine class provides low level access to a socket.
\reentrant
\ingroup network
\inmodule QtNetwork
QtSocketLayer provides basic socket functionality provided by the
operating system. It also keeps track of what state the socket is
in, and which errors that occur.
The classes QTcpSocket, QUdpSocket and QTcpServer provide a
higher level API, and are in general more useful for the common
application.
There are two main ways of initializing the a QNativeSocketEngine; either
create a new socket by passing the socket type (TcpSocket or
UdpSocket) and network layer protocol (IPv4Protocol or
IPv6Protocol) to initialize(), or pass an existing socket
descriptor and have QNativeSocketEngine determine the type and protocol
itself. The native socket descriptor can later be fetched by
calling socketDescriptor(). The socket is made non-blocking, but
blocking behavior can still be achieved by calling waitForRead()
and waitForWrite(). isValid() can be called to check if the socket
has been successfully initialized and is ready to use.
To connect to a host, determine its address and pass this and the
port number to connectToHost(). The socket can then be used as a
TCP or UDP client. Otherwise; bind(), listen() and accept() are
used to have the socket function as a TCP or UDP server. Call
close() to close the socket.
bytesAvailable() is called to determine how much data is available
for reading. read() and write() are used by both TCP and UDP
clients to exchange data with the connected peer. UDP clients can
also call hasMoreDatagrams(), nextDatagramSize(),
readDatagram(), and writeDatagram().
Call state() to determine the state of the socket, for
example, ListeningState or ConnectedState. socketType() tells
whether the socket is a TCP socket or a UDP socket, or if the
socket type is unknown. protocol() is used to determine the
socket's network layer protocol.
localAddress(), localPort() are called to find the address and
port that are currently bound to the socket. If the socket is
connected, peerAddress() and peerPort() determine the address and
port of the connected peer.
Finally, if any function should fail, error() and
errorString() can be called to determine the cause of the error.
|
46312 |
- |
| qnativesocketengine_p.h |
|
6329 |
- |
| qnativesocketengine_p_p.h |
|
6753 |
- |
| qnativesocketengine_unix.cpp |
Extracts the port and address from a sockaddr, and stores them in
\a port and \a addr if they are non-null.
|
54599 |
- |
| qnativesocketengine_win.cpp |
Internetwork Version 6 |
60276 |
- |
| qnet_unix_p.h |
|
3773 |
- |
| qsctpserver.cpp |
!
\class QSctpServer
\since 5.8
\brief The QSctpServer class provides an SCTP-based server.
\ingroup network
\inmodule QtNetwork
SCTP (Stream Control Transmission Protocol) is a transport layer
protocol serving in a similar role as the popular protocols TCP
and UDP. Like UDP, SCTP is message-oriented, but it ensures reliable,
in-sequence transport of messages with congestion control like
TCP. See the QSctpSocket documentation for more protocol details.
QSctpServer is a convenience subclass of QTcpServer that allows
you to accept incoming SCTP socket connections either in TCP
emulation or in datagram mode.
The most common way to use QSctpServer is to construct an object
and set the maximum number of channels that the server is
prepared to support, by calling setMaximumChannelCount(). You can set
the TCP emulation mode by passing a negative argument in this
call. Also, a special value of 0 (the default) indicates to use
the peer's value as the actual number of channels. The new incoming
connection inherits this number from the server socket descriptor
and adjusts it according to the remote endpoint settings.
In TCP emulation mode, accepted clients use a single continuous
byte stream for data transmission, and QSctpServer acts like a
plain QTcpServer. Call nextPendingConnection() to accept the
pending connection as a connected QTcpSocket. The function returns
a pointer to a QTcpSocket in QAbstractSocket::ConnectedState that
you can use for communicating with the client. This mode gives
access only to basic SCTP protocol features. The socket transmits SCTP
packets over IP at system level and interacts through the
QTcpSocket interface with the application.
In contrast, datagram mode is message-oriented and provides a
complete simultaneous transmission of multiple data streams
between endpoints. Call nextPendingDatagramConnection() to accept
the pending datagram-mode connection as a connected QSctpSocket.
\note This class is not supported on the Windows platform.
\sa QTcpServer, QSctpSocket, QAbstractSocket
|
6702 |
- |
| qsctpserver.h |
|
906 |
- |
| qsctpserver_p.h |
|
890 |
- |
| qsctpsocket.cpp |
!
\class QSctpSocket
\since 5.8
\brief The QSctpSocket class provides an SCTP socket.
\ingroup network
\inmodule QtNetwork
SCTP (Stream Control Transmission Protocol) is a transport layer
protocol serving in a similar role as the popular protocols TCP
and UDP. Like UDP, SCTP is message-oriented, but it ensures reliable,
in-sequence transport of messages with congestion control like
TCP.
SCTP is connection-oriented protocol, which provides the complete
simultaneous transmission of multiple data streams between
endpoints. This multi-streaming allows data to be delivered by
independent channels, so that if there is data loss in one stream,
delivery will not be affected for the other streams.
Being message-oriented, SCTP transports a sequence of messages,
rather than transporting an unbroken stream of bytes as does TCP.
Like in UDP, in SCTP a sender sends a message in one operation,
and that exact message is passed to the receiving application
process in one operation. But unlike UDP, the delivery is
guaranteed.
It also supports multi-homing, meaning that a connected endpoint
can have alternate IP addresses associated with it in order to
route around network failure or changing conditions.
QSctpSocket is a convenience subclass of QTcpSocket that allows
you to emulate TCP data stream over SCTP or establish an SCTP
connection for reliable datagram service.
QSctpSocket can operate in one of two possible modes:
\list
\li Continuous byte stream (TCP emulation).
\li Multi-streamed datagram mode.
\endlist
To set a continuous byte stream mode, instantiate QSctpSocket and
call setMaximumChannelCount() with a negative value. This gives the
ability to use QSctpSocket as a regular buffered QTcpSocket. You
can call connectToHost() to initiate connection with endpoint,
write() to transmit and read() to receive data from the peer, but
you cannot distinguish message boundaries.
By default, QSctpSocket operates in datagram mode. Before
connecting, call setMaximumChannelCount() to set the maximum number of
channels that the application is prepared to support. This number
is a parameter negotiated with the remote endpoint and its value
can be bounded by the operating system. The default value of 0
indicates to use the peer's value. If both endpoints have default
values, then number of connection channels is system-dependent.
After establishing a connection, you can fetch the actual number
of channels by calling readChannelCount() and writeChannelCount().
\snippet code/src_network_socket_qsctpsocket.cpp 0
In datagram mode, QSctpSocket performs the buffering of datagrams
independently for each channel. You can queue a datagram to the
buffer of the current channel by calling writeDatagram() and read
a pending datagram by calling readDatagram() respectively.
Using the standard QIODevice functions read(), readLine(), write(),
etc. is allowed in datagram mode with the same limitations as in
continuous byte stream mode.
\note This class is not supported on the Windows platform.
\sa QSctpServer, QTcpSocket, QAbstractSocket
|
17244 |
- |
| qsctpsocket.h |
|
1138 |
- |
| qsctpsocket_p.h |
|
1280 |
- |
| qsocks5socketengine.cpp |
inserts the host address in buf at pos and updates pos.
if the func fails the data in buf and the value of pos is undefined
|
64309 |
- |
| qsocks5socketengine_p.h |
|
8874 |
- |
| qtcpserver.cpp |
! \class QTcpServer
\brief The QTcpServer class provides a TCP-based server.
\reentrant
\ingroup network
\inmodule QtNetwork
This class makes it possible to accept incoming TCP connections.
You can specify the port or have QTcpServer pick one
automatically. You can listen on a specific address or on all the
machine's addresses.
Call listen() to have the server listen for incoming connections.
The newConnection() signal is then emitted each time a client
connects to the server. When the client connection has been added
to the pending connection queue using the addPendingConnection()
function, the pendingConnectionAvailable() signal is emitted.
Call nextPendingConnection() to accept the pending connection as
a connected QTcpSocket. The function returns a pointer to a
QTcpSocket in QAbstractSocket::ConnectedState that you can use for
communicating with the client.
If an error occurs, serverError() returns the type of error, and
errorString() can be called to get a human readable description of
what happened.
When listening for connections, the address and port on which the
server is listening are available as serverAddress() and
serverPort().
Calling close() makes QTcpServer stop listening for incoming
connections.
Although QTcpServer is mostly designed for use with an event
loop, it's possible to use it without one. In that case, you must
use waitForNewConnection(), which blocks until either a
connection is available or a timeout expires.
\sa QTcpSocket, {Fortune Server}, {Threaded Fortune Server},
{Torrent Example}
|
22897 |
- |
| qtcpserver.h |
|
2074 |
- |
| qtcpserver_p.h |
|
2116 |
- |
| qtcpsocket.cpp |
!
\class QTcpSocket
\brief The QTcpSocket class provides a TCP socket.
\reentrant
\ingroup network
\inmodule QtNetwork
TCP (Transmission Control Protocol) is a reliable,
stream-oriented, connection-oriented transport protocol. It is
especially well suited for continuous transmission of data.
QTcpSocket is a convenience subclass of QAbstractSocket that
allows you to establish a TCP connection and transfer streams of
data. See the QAbstractSocket documentation for details.
\note TCP sockets cannot be opened in \l QIODeviceBase::Unbuffered mode.
\sa QTcpServer, QUdpSocket, QNetworkAccessManager,
{Fortune Server}, {Fortune Client},
{Threaded Fortune Server}, {Blocking Fortune Client},
{Torrent Example}
|
2097 |
- |
| qtcpsocket.h |
|
1212 |
- |
| qtcpsocket_p.h |
|
747 |
- |
| qudpsocket.cpp |
! \class QUdpSocket
\reentrant
\brief The QUdpSocket class provides a UDP socket.
\ingroup network
\inmodule QtNetwork
UDP (User Datagram Protocol) is a lightweight, unreliable,
datagram-oriented, connectionless protocol. It can be used when
reliability isn't important. QUdpSocket is a subclass of
QAbstractSocket that allows you to send and receive UDP
datagrams.
The most common way to use this class is to bind to an address and port
using bind(), then call writeDatagram() and readDatagram() /
receiveDatagram() to transfer data. If you want to use the standard
QIODevice functions read(), readLine(), write(), etc., you must first
connect the socket directly to a peer by calling connectToHost().
The socket emits the bytesWritten() signal every time a datagram
is written to the network. If you just want to send datagrams,
you don't need to call bind().
The readyRead() signal is emitted whenever datagrams arrive. In
that case, hasPendingDatagrams() returns \c true. Call
pendingDatagramSize() to obtain the size of the first pending
datagram, and readDatagram() or receiveDatagram() to read it.
\note An incoming datagram should be read when you receive the readyRead()
signal, otherwise this signal will not be emitted for the next datagram.
Example:
\snippet code/src_network_socket_qudpsocket.cpp 0
QUdpSocket also supports UDP multicast. Use joinMulticastGroup() and
leaveMulticastGroup() to control group membership, and
QAbstractSocket::MulticastTtlOption and
QAbstractSocket::MulticastLoopbackOption to set the TTL and loopback socket
options. Use setMulticastInterface() to control the outgoing interface for
multicast datagrams, and multicastInterface() to query it.
With QUdpSocket, you can also establish a virtual connection to a
UDP server using connectToHost() and then use read() and write()
to exchange datagrams without specifying the receiver for each
datagram.
The \l{broadcastsender}{Broadcast Sender},
\l{broadcastreceiver}{Broadcast Receiver},
\l{multicastsender}{Multicast Sender}, and
\l{multicastreceiver}{Multicast Receiver} examples illustrate how
to use QUdpSocket in applications.
\sa QTcpSocket, QNetworkDatagram
|
17316 |
- |
| qudpsocket.h |
|
2201 |
- |