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
10
votes
2 answers

QTcpServer can only be accessed through localhost

My computer's IP on the local network is 192.168.0.100, I start my QTcpServer with if (!tcpServer->listen(QHostAddress::LocalHost, 1234)) { When I try to connect to it with netcat 192.168.0.100 1234, the connection is refused, but netcat localhost…
sashoalm
  • 75,001
  • 122
  • 434
  • 781
8
votes
2 answers

How is QTcpServer really listening for connections

I am interested in how QTcpServer works behind the scenes regarding threads and blocking. QTcpServer has a listen() method which returns immediately. If listening started successfully the server will emit the signal newConnection(). I'm interested…
irpbc
  • 851
  • 1
  • 8
  • 16
7
votes
1 answer

QSslSocket: cannot resolve SSLV2_client_method

I have created a sslclient and sslserver using QSslSocket in Qt 5.4.1 in debian wheezy. When I run the program they dont work at all. After debuging my code I saw when it try to create a new object from QSslSocket it return this error (cannot…
Ehsan Maiqani
  • 1,684
  • 1
  • 14
  • 16
6
votes
1 answer

Get remote host Ip address QTcpServer

I'm using Qt to create TCP server using QTcpServer. Every time a client connects to server, I would like to know the remote host's IP address and port number. I tried searching documentation but couldn't find any information on this topic. I know…
nik
  • 8,387
  • 13
  • 36
  • 44
5
votes
2 answers

PyQt QTcpServer: How to return data to multiple clients?

I am looking to create a QTcpServer using PyQt that can simultaneously return data to 2 or more clients. I assume that this will require threading. Using the threadedfortuneserver.py example as a test case (included with PyQt4, on my system it is…
XandYandZ
  • 283
  • 1
  • 3
  • 9
5
votes
2 answers

How to send a file along with its filename over QTCPSocket?

Is there any simple way to send a file to server with the filename included so that the filename in server and client are exactly the same? Here is my code Sender QString path = QApplication::applicationDirPath()+"/belajardansa.bmp"; QFile…
Ananta S.
  • 81
  • 1
  • 4
5
votes
1 answer

Slow QTcpServer with lots of simultaneous clients

I'm writing TCP server in Qt that will serve large files. Application logic is as follows: I've subclassed QTcpServer and reimplemented incomingConnection(int) In incomingConnection, I'm creating instance of "Streamer" class "Streamer" is using…
AdrianEddy
  • 707
  • 1
  • 8
  • 13
4
votes
2 answers

I just cannot get QTcpServer working (newConnection never called)

I know similar question to this have been asked, but I haven't found an answer that fixes my problem. I'm adapting some existing Qt code to add server functionality to a program my company uses. To that end I added a QTcpServer object to the…
Teknogrebo
  • 1,247
  • 1
  • 12
  • 22
4
votes
1 answer

How to Create a HTTP MJPEG Streaming Server With QTcp-Server Sockets?

I want to create a Http Server to send an MJPEG Stream. I'm Already able to send an Image but no Live-Stream. What I did: Created an TCP-Server. When a client Connects a TCP-Socket is created. Then I implemented a ReadyRead SLOT which gots executed…
hypnomaki
  • 593
  • 9
  • 22
4
votes
3 answers

Freeze on sending large file using QTcpSocket

I'm trying to send and receive some large files (at least 16GB) from a PC to another. The application freeze when the client application received around 2GB and it consume almost all of my memory (also used up around 2GB of memory). I do not have…
Ste
  • 271
  • 1
  • 2
  • 13
3
votes
3 answers

QT QTcpServer telnet taking characters \r\n

I'm writing a QTcpServer. I used telnet.exe as a client for testing. Upon a new client connection my server sends a Hi! message to the client which is displayed - all is well and fine so far. But when I type something in the telnet.exe window, a…
Neel Basu
  • 12,638
  • 12
  • 82
  • 146
3
votes
1 answer

On server side in QTcpServer appears: The remote host closed the connection

I have a QTcpServer app and QTcpClient app. See my screenshot. When a client after interacting with server is disconnecting from server, on server side appears event (in client socket - in slot): void…
3
votes
2 answers

Switching from Qt 5.7 to Qt 5.8 - "the proxy type is invalid for this operation"

I'm trying to re-compile a networking application that worked fine with Qt 5.7 using Qt 5.8. However, using Qt 5.8, the server fails to listen(): int myPort = 52000; //some accessible port QTcpServer* server = new…
Nicolas Holthaus
  • 7,763
  • 4
  • 42
  • 97
3
votes
0 answers

QTcpServer never reach incomingConnection

I try to implement my own server class inheriting QTcpServer. here is the simple code i try to run : server.cpp MyServer::MyServer(QObject *parent) : QTcpServer(parent) { } void MyServer::incomingConnection(qintptr handle) { qDebug() <<…
Bastien
  • 994
  • 11
  • 25
3
votes
2 answers

How to send data from server to client as QByteArray/QDataStream

In the fortuneserver sample of Qt, a QString is sent by the method sendFortune(). Therefore one QString is selected from the QStringList fortunes: QByteArray block; QDataStream out(&block,…
3ef9g
  • 781
  • 2
  • 9
  • 19
1
2 3
9 10