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

Programm crashes when QTcpServer is called

I'm trying a very, very simple QT networking program. For some reason it crashes when executing without any error message, since it's not printing out any of the outputs to the command line as expected. Here's the code: qtTCPservertest.pro QT …
user3085931
  • 1,757
  • 4
  • 29
  • 55
1
vote
1 answer

Ssl Server using QSslSocket in Qt

I have implemented a ssl server using QSslSocket and run it correctly. But I have some problem with it that I couldn't solve them immediately. I thought that just connecting readyRead() signal to a slot for reading buffer is sufficient to do that…
Ehsan Maiqani
  • 1,684
  • 1
  • 14
  • 16
1
vote
0 answers

Python PyQt4: Using QTcpServer to handle data from client, but I can't receive the data

I am confused that why the QTcpSocket instance could send text to client before connected in the official example. While a connection came in, the result is: New connection came 0 New connection ran into thread: 944 My code is at the bottom of the…
elonzh
  • 1,199
  • 2
  • 11
  • 16
1
vote
0 answers

bidirectional communication via QTcpSocket

I'm writing an application that communicates via QTcpSocket between Server and Client. Server is an application with gui on standard pc. Client is a console application on Raspberry pi. client.cpp #include "client.h" #include #include…
Adam Radomski
  • 2,515
  • 2
  • 17
  • 28
1
vote
1 answer

QTcpServer::incomingConnection(qintptr socketDescriptor) is it possible to connect with specified socket?

void server::incomingConnection(qintptr socketDescriptor) { qDebug() << "incoming connection"; connection* new_connection = new connection(this); new_connection->set_socket_descriptor(socketDescriptor); connect(new_connection,…
Mher Didaryan
  • 95
  • 2
  • 13
1
vote
0 answers

QTcpServer newConnection signal is never received in debug mode

For some reason, the newConnection signal does not seem to be emitted or handled correctly when I run in debug mode. Below is an example, when I for example telnet to this server, OnNewConnection is called when i run the program in release mode but…
1
vote
1 answer

Server crash when trying to access QSslSocket functions

So I am working on a very basic server/client thing in QTCreator. I am supposed to have the server send the certificate to the client when a client tries to connect. I have the following code in the server: void Dialog::createSocket() { …
DDauS
  • 105
  • 1
  • 2
  • 11
1
vote
1 answer

Difference between a thread with and without an event loop

Thread with an event loop We have created a QTcpServer object in a separate thread and it is listening for incoming connections and processing them as they occur. At some point the is deleted and there is nothing to generate events in the thread.…
TheMeaningfulEngineer
  • 15,679
  • 27
  • 85
  • 143
1
vote
3 answers

When subclassing QTcpServer, how can I delay emitting the newConnection() signal?

I want to create an SSL server, so I subclass QTcpServer and I override incomingConnection(), where I create a QSslSocket, set its descriptor, and call QSslSocket::startServerEncryption. At this point I need to wait for QSslSocket::encrypted()…
sashoalm
  • 75,001
  • 122
  • 434
  • 781
1
vote
1 answer

QTcpSocket false connect to QTcpServer

Since some time I have been working with Qt (sorry for my english). I'm now working with QtNetwork. I need to create a client-server like system. The basic ideas are these: The IP's of both (clients and server) can change. There is no way to store…
1
vote
1 answer

How can i get Access to a QThread in a QTcpServer

i've just made an own implementation of QTcpServer and overloaded the incomingConnection function. void Server::incomingConnection(int handle) //Server inherits from QTcpServer { qDebug()<<"Server::incomingConnection"<
Manuel
  • 904
  • 1
  • 7
  • 17
1
vote
1 answer

QTcpServer crashes on close

I was programming a server, I programmed the service and a manager. When I stop the server with the UI Server Manager, the server calls a function called "stopServer()", that function contains the following: qDebug() << "Stopping the server..."; //…
Spamdark
  • 1,341
  • 2
  • 19
  • 38
1
vote
2 answers

QTcpSocket emits "Connection Refused Error" after few Successful connection?

I am designing an application for accessing a remote desktop using Qt creator. In order to get "Quit" Signal from the Remote desktop (after completing my purpose), i am using Tcpserver and Tcpsocket. My Pc acts as a Server while remote pc acts as a…
skg
  • 948
  • 2
  • 19
  • 35
1
vote
2 answers

QT QTcpServer in thread; how to close listening server on exit?

I have a thread subclass like this class MyThread : public QThread { public: MyThread (void); ~MyThread (void); void run(); void stop(); // close server and terminate thread public slots: void slotCloseServer(); signals: …
Professor Chaos
  • 8,850
  • 8
  • 38
  • 54
1
vote
1 answer

QTcp[server and socket]: can't read file sent

Good morning, I’m looking for an example about sending a file from one pc to an other with QTcpSocket. I tried to create my own code. I have an application, in which, the user will choose a file from his DD ( all types) and send it to the TcpServer,…
tasnim
  • 11
  • 1