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.

132 questions
9
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
  • 63,456
  • 96
  • 348
  • 677
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
  • 811
  • 1
  • 8
  • 15
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,057
  • 11
  • 15
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
  • 7,259
  • 11
  • 33
  • 40
5
votes
1 answer

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
  • 273
  • 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
  • 677
  • 1
  • 7
  • 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,227
  • 1
  • 12
  • 20
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
  • 477
  • 7
  • 20
4
votes
1 answer

Sending data from a server to a client

I have two projects, one for a server and one for a client. On the client, when I want to send data, I create a QTcpSocket member variable, and then send data using the write() method. On the server, I receive the information, but I want to send…
Lighthat
  • 890
  • 3
  • 14
  • 25
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
  • 251
  • 1
  • 2
  • 12
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
  • 11,848
  • 10
  • 71
  • 138
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
  • 6,800
  • 3
  • 39
  • 79
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
  • 879
  • 7
  • 23
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
  • 661
  • 1
  • 8
  • 16
1
2 3
8 9