Questions tagged [qtcpsocket]

The QTcpSocket class, part of the Qt framework, provides a TCP socket.

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.

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

301 questions
0
votes
1 answer

Linux Netcat works as Expected but not QTCPSocket on Raspberry Pi

I have 2 Raspberry Pis, one sender and one receiver which acts as an Access Point using a USB WiFi dongle. I have Qt 5.4.0 code on the sender that uses a USB/FTDI XBee SB6 WiFi unit to send TCP packets to the receiver Pi after connecting to it's…
PhilBot
  • 748
  • 18
  • 85
  • 173
0
votes
2 answers

Unable to retrieve multiline data from qtcpsocket qt

I am writing a function to communicate with a test server that I didn't write. I send a command, and need to immediately capture the multi-line response before doing anything else. Of course, I'd like to not block my whole UI, which shouldn't be a…
Rachael
  • 1,965
  • 4
  • 29
  • 55
0
votes
1 answer

Sending Bytes using QTcpSocket

I have an embedded device that I am trying to communicate with via TCP over a wireless connection. Below is the structure of the data that the device is expecting: char[] = { 0x55, 0x55, 0x55, 0x55 //header block //start data here 0x01,…
user3830784
  • 355
  • 3
  • 17
0
votes
1 answer

How to write a raw QByteArray or manipulate the QByteArray

I defined a QIODevice (especially a QTcpSocket) and would like to write a string as raw format. I describe my wishes with the following example: char* string= "Hello World"; QByteArray bArray; QDataStream stream(&bArray,…
3ef9g
  • 781
  • 2
  • 9
  • 19
0
votes
0 answers

How to implement a simple tcp connection in Qt?

I tried to modify the Qt network tutorial, and implemented it like: quint16 blockSize; void Client::readData() { qDebug() << "Received Data!"; QByteArray data; QDataStream in(tcpSocket); in.setVersion(QDataStream::Qt_4_0); if…
arc_lupus
  • 3,942
  • 5
  • 45
  • 81
0
votes
0 answers

qt tcp connection under linux

I'm trying to create a client-server application on QT. I have no problems with algorithms. QT is fine. Everything works fine, but only under Windows. When running the application under Linux, the client successfully connects to the server and…
0
votes
1 answer

Socket.io (Node.js) Doesn't Detect Connected QTcpSocket

I'm trying to connect a QTcpSocket to a Nodejs application. The C++ QT Code is: nodeSocket = new QTcpSocket(this); nodeSocket->connectToHost("127.0.0.1", 3000); if (nodeSocket->waitForConnected(3000)) { qDebug() << "Connected!"; } The Node.js…
wpakt
  • 1,073
  • 2
  • 13
  • 18
0
votes
1 answer

node.js net module pings and messages not happening

I have two node.js applications running side by side on my server and I wan't to send server-side messages between them in a light weight manner using native node.js (v0.10.33) module net I intend the first application to send messages to the…
8DK
  • 704
  • 1
  • 5
  • 15
0
votes
1 answer

Qt:Design QtcpSocket to connect with Multiple TcpServer?

I want to design an Application with QTcpSocket to connect to multiple servers and get data from each server and display it on the GUI. A QTcpServer with multiple Client is quiet easy. But I need to design my application in a very similar way. In…
skg
  • 948
  • 2
  • 19
  • 35
0
votes
2 answers

Concurrent access to a QTcpSocket object

I created a class that inherits from QThread in order to have a thread running with a QTcpSocket object. When this thread starts, it connects to a server: if the connection is refused or if the connection is lost, the thread tries to reconnect to…
enzom83
  • 8,080
  • 10
  • 68
  • 114
0
votes
1 answer

Set sockopt of QTcpSocket

I am creating a Linux C++/Qt5 app which opens a TCP socket for an outbound connection (to a remote server). I create a QTcpSocket and then try to set sockopt options as follows: m_tcpSocket = new QTcpSocket(this); int fd =…
TSG
  • 4,242
  • 9
  • 61
  • 121
0
votes
1 answer

Qt Threading code different behavior in MAC,Linux and Windows

I have written code for a server which accepts connections from different clients. Each client is serviced in different threads. Each thread accesses a database to get data and then updates this data to all the clients connected to server. 1) For…
AmarSneh
  • 103
  • 1
  • 6
0
votes
3 answers

QTcpSocket Read Error

I have a Qt based TCP client and server making use of QTcpServer and QTcpSocket classes for communication. The server is compiled using Qt 5.3.1 and the client is compiled using Qt 4.8.1. This is done so because the client is a part of a framework…
asumang
  • 673
  • 1
  • 6
  • 11
0
votes
1 answer

QTcpSocket only reading data every ~0.5s, even with really small packets, any way to speed it up?

I have a client/server setup with QTcpSocket and QTcpServer, it's a real-time thing so it needs to be as fast as possible ideally, but packets are only being sent and received every ~0.5 seconds even though they are really small (rarely more than a…
Ben
  • 470
  • 1
  • 6
  • 18
0
votes
1 answer

Can't make QTcpSocket/QTcpServer work together

I'm trying to understand how QTcpSocket and QTcpServer works together. So I wrote this simple example, which starts server and client socket on localhost: QTcpServer server; qDebug() << "Listen: " << server.listen( QHostAddress::Any,…
Valentin T.
  • 519
  • 3
  • 12