Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
tcpwait.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4
#
include
<
QTcpSocket
>
5
6
int
test_tcpwait
()
7
{
8
QTcpSocket socket;
9
socket.connectToHost(
"localhost"
, 1025);
10
11
//! [0]
12
int
numRead = 0, numReadTotal = 0;
13
char
buffer[50];
14
15
forever {
16
numRead = socket.read(buffer, 50);
17
18
// do whatever with array
19
20
numReadTotal += numRead;
21
if
(numRead == 0 && !socket.waitForReadyRead())
22
break
;
23
}
24
//! [0]
25
return
numReadTotal;
26
}
test_tcpwait
int test_tcpwait()
Definition
tcpwait.cpp:6
qtbase
src
network
doc
snippets
network
tcpwait.cpp
Generated on
for Qt by
1.14.0