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

QThread and QTcpSocket

I did serious mistake when I was doing some project and now I have to re-program it from bottom.. I'm writing multi-threaded server which will handle connections, requests, etc.. But, when I created new class with base object of QThread, I was…
Nika
  • 1,864
  • 3
  • 23
  • 44
0
votes
1 answer

sending qimage over qtcpsocket: received only part of the data

i am creating an application where i need to send some images over tcp. the sending part is QImage image; image.load("image.png", "PNG"); image.setText("name", "color"); QByteArray ba; QBuffer buffer(&ba); image.save(&buffer, "PNG"); int…
stavrop
  • 465
  • 2
  • 8
  • 20
0
votes
1 answer

Qt mp3 file to datastream

My primary objective is to send a mp3 file over network using QDataStream, QTcpServer and QTcpSocket. But I have broken this task to smaller pieces. At first I need to get the mp3 file to the correct format so that It can be "fed" to the data…
Majster
  • 3,611
  • 5
  • 38
  • 60
0
votes
0 answers

Best approach to obtain the port of a QTcpServer in a child process?

What is the best approach to retrieve the port number a QTcpServer in a child process is listening on, assuming we do not want to use fixed port numbers for our TCP servers? So far I have been experimenting with the following two approaches: Start…
Ton van den Heuvel
  • 10,157
  • 6
  • 43
  • 82
0
votes
2 answers

Console Chat Using QTcpSocket and QTcpServer

I want to write a console chat program in qt framework.I have a problem with sending messages. Client sends messages to server but server doesn't take the messages until client program is closed.When client is closed, server displays all messages.I…
Viplime
  • 141
  • 4
  • 14
0
votes
1 answer

Qt QTcpSocket QByteArray/QString issues with special characters and proper syntax

I'm having trouble some special characters in Qt, the 2 being the quote and newline. I'm connecting to the server using telnet, and the server automatically puts quotes at the beginning and end of the input for some reason. I'm having trouble…
Knox
  • 1,150
  • 1
  • 14
  • 29
0
votes
1 answer

State of a QTcpSocket

I have a problem with the QTcpSocket library. I created two programs that communicate with the same client using the same socket connection. Unfortunately, doing in this way, if the programs write at the same time, the client reads only one string…
Daniele
  • 45
  • 5
0
votes
2 answers

QTcpSocket write an struct of data

I used to send an struct with C++ sockets, and now I'm trying to use QTcpSockets instead. This is the struct: const unsigned int uiMessageSize = 4; typedef struct { unsigned char uc_stx; unsigned char uc_add; unsigned…
Roman Rdgz
  • 12,836
  • 41
  • 131
  • 207
0
votes
1 answer

Assigning QTcpSocket object

I have a class with QTcpSocket socket; as private member. Then, in class constructor I'm initialising with socket = new QTcpSocket(); When compiling, I'm getting error: error: no match for ‘operator=’ in ‘((MyClass*)this)->MyClass::socket =…
Roman Rdgz
  • 12,836
  • 41
  • 131
  • 207
0
votes
1 answer

Multiple calls on QTcpSocket::write?

According to here http://doc-snapshot.qt-project.org/4.8/qiodevice.html Certain subclasses of QIODevice, such as QTcpSocket and QProcess, are asynchronous. For example, the first write call has been made to send a chunk of data. Now before the…
user25101622
  • 193
  • 2
  • 13
-1
votes
1 answer

Omron FINS protocol realization at PC side using Qt(C++) [ Driver ]

I am working for a cross-platform desktop application . I develop it in C++ with usage of Qt and already implemented PC side Omron FINS TCP protocol driver via sockets ( QTcpSocket ). When I read from register via FINS protocol - I receive right…
St Sht
  • 19
  • 3
  • 11
-1
votes
1 answer

Connecting to two server from client in qt

I need simultaneous persistent connection to two Servers from my Qt TCP client. Do I need threads for this or there is another way. Any Examples would be great.
D_Ranjan
  • 1
  • 1
-1
votes
1 answer

Qt QTcpSocket Reading Data Overlap Causes Invalid TCP Behavior During High Bandwidth Reading and Writing

Summary: Some of the memory within the TCP socket to be overwritten by other incoming data. Application: A client/server system that utilizes TCP within Qt (QTcpSocket and QTcpServer). The client request a frame from the server(just a simple string…
shn
  • 865
  • 5
  • 14
-1
votes
1 answer

QtcpServer: Qt how to get python string to label

hello everyone I use python send a string to qt but i do not know how show the string on a label can anyone help me ??? my mainwindow.cpp is MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { …
robinshion
  • 33
  • 1
  • 7
-1
votes
1 answer

What is the difference between the following Qt QStrings which take Json string as input? Using QTcpSockets

I have a json message to send over a QTcpSocket. Before sending message, the Json message is formatted as below: Case 1 : //Heartbeat = QString("{\"messageType\":\"Heartbeat\", \"Thread_Name\":%1, \"Heartbeat\":%2}").arg(Thread_Name).arg(HbCount); …
ringul
  • 47
  • 7
1 2 3
20
21