Questions tagged [qtcpserver]

QTcpServer is a Qt class embedding a TCP-based server.

The QTcpServer class provides a TCP-based server.

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.

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

140 questions
0
votes
1 answer

Type qintptr not found in Qt5.4.1

I'm working with Qt5.4.1, and implementing a server-client application. In the QTcpServer class the method: void incomingConnection(int socketDescriptor); has integer type for the socketDescriptor, but for Qt5.5, this method has changed and has…
Waleed A
  • 95
  • 10
0
votes
1 answer

QTcpSocket readyRead() signal emits multiple times

I'm new to Qt and currently learning to code with QTcpServer and QTcpSocket. My code to process data is like Myclass() { connect(&socket, &QTcpSocket::readyRead, this, &MyClass::processData); } void MyClass::processData() { /* Process the…
Ryan
  • 373
  • 4
  • 15
0
votes
0 answers

Connection problems: TCP Socket with QTcpServer and Android client

I'm trying to make a Socket connection via TCP protocol. But my server (written in C++ and running on my PC) does not receive connection request from my client (written in Java and running on Android) ServerSocket.h (in my PC) class ServerSocket:…
josper04
  • 41
  • 3
0
votes
1 answer

Qt creator cannot find, QTcpServer and QTcpSocket

Eventhough, I put 'network' in .pro file, My Qt creator cannot find QTcpSocket and QTcpServer. What should I do? I remove the Qtcreator and redownloaded already but it also did not work. My Linux version is Ubuntu 14.04 LTS and I downloaded QT…
Ray
  • 53
  • 1
  • 7
0
votes
1 answer

QTcpServer with android client unable to print or use data received from client

I am developing Client-Server application in C++ using Qt framework, but the clients can be android phones and computers(Qt client app) Now i'm having troubles to handle Reception of data on the server side; the server is not receiving data…
Xsmael
  • 3,624
  • 7
  • 44
  • 60
0
votes
1 answer

QTcpServer error C1083, "no such file or directory"

I am using Qt 5.4.1 offline version and I am getting a file not found error for QTcpServer. I posted my .pro file to show that I do have the += network in there. Please let me know if you have any idea why I am getting this error!…
matt
  • 1
  • 1
0
votes
1 answer

QTcpServer - how to multi-thread - example is bad

I'm trying to make QTcpServer start a separate thread for each connection. There's example code available that does just that: http://doc.qt.io/qt-5/qtnetwork-threadedfortuneserver-example.html This code works by subclassing QThread. If I build my…
Philipp
  • 957
  • 1
  • 6
  • 20
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

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
1 answer

Qt: Server should broadcast changing value and client should listen for it

I wrote a program that calculates Pi. It approximates the digit positions after the 3.14 … Now I want to know which position is calculated by my program currently. But I don't want to wait in front of the computer. Therefore I implement a QTcpServer…
3ef9g
  • 781
  • 2
  • 9
  • 19
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
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
0
votes
1 answer

Qt slot connected successful but wasn't fired

I try to call slot of my class via newConnection() signal of QTcpServer class. connect() function returns true, but the slot weren't executed. Here's what i made: class server : QObject { Q_OBJECT public: server(); QTcpServer *srv; …
WildDev
  • 2,250
  • 5
  • 35
  • 67
0
votes
0 answers

Sent a message from C# to QT

I need to send a string line from a C# client (3.5) to a QT server. Everything works ok except one thing that on the server side I have to check a size of the line which is first 2 bytes. (I can't just make an infinite loop of listing the client). I…
Vadim
  • 85
  • 1
  • 9