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

Make QTcpServer accept only IPv4 connections

I'm implementing an FTP server, and it doesn't support IPv6 yet (IPv6 connections can't use PORT and PASV, they need to use EPRT and EPSV instead for specifying data connections). So I need to accept only IPv4 connections from my QTcpServer. Right…
sashoalm
  • 75,001
  • 122
  • 434
  • 781
3
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…
ozzymado
  • 960
  • 3
  • 15
  • 26
3
votes
0 answers

QDataStream writing to large file

I have a file transfer application and I'm using a QDataStream to write data read from a QTCPSocket to a file. I thought when I wrote this that the QDataStream would remain at a fixed size but it seems that as I read from my socket and stream data…
2
votes
1 answer

QTcpSocket readyRead() Signal emitted twice

I have QTcpServer. I want to send large data from client side and how to catch signal, when all data is received on server? "while (socket->bytesavailable)" doesn't work. For example: when qbytearray size is 9000, which is send from client, on the…
Tazo leladze
  • 1,430
  • 1
  • 16
  • 27
2
votes
1 answer

Writing to QTcpSocket does not always emit readyRead signal on opposite QTcpSocket

I have been stuck on this for the past 5 days, I have no idea how to proceed. Overview: I have a client UI which interacts with a data handler library, and the data handler library utilizes a network manager library, which is where my problem…
CybeX
  • 2,060
  • 3
  • 48
  • 115
2
votes
1 answer

Qt, Sending multiple data types from client to server + data Streaming

I have a Client/Server based Qt application, using QTcpServer and QTcpSocket, I managed to do the connection and send some data back and forth between the client and the server. The client sends many types of data to the server (string, int, files…
2
votes
1 answer

Why I can't set a specific address for my QTcpServer?

I just want to setup my QTcpServer with a specific address. I have tried it with this code but it does not work... server.listen(QHostAddress::setAddress("127.0.0.1"),8888); This is the Error: Cannot call member function 'bool…
Hannes Tiltmann
  • 2,296
  • 1
  • 12
  • 20
2
votes
1 answer

QTcpServer->listen() on WinCE6 "protocol type not supported"

I made an application which has to run on a Win32 as well as WinCE6 (x86) machine. It works perfectly on Win32 but when it executes on a WinCE6 machine: m_TcpServer->listen(QHostAddress::Any, 1024) it returns false and says: "protocol type not…
Scorpion
  • 49
  • 1
  • 9
2
votes
1 answer

I can not create a list of servers

I'm trying to create a server using qttcpserver. My code was written for this example. The only difference is that I also used the thread pool. I have a form on which there are two buttons. The first button creates an object of my class server, and…
bikajo
  • 45
  • 4
2
votes
3 answers

Why client dont connect to server? Qt

Programm works, but client can't connect to the server. (i run 2 examples of programm: client and server). I can't find where is my mistake. I wrote the codes below.You will see what i want to do if you look at main function. //main.cpp int…
ExiD
  • 87
  • 2
  • 12
2
votes
3 answers

Providing a WebSockets server in a Qt application

I have created a QTcpServer on port 1024. I want to connect to it from a websocket by using the URL ws://localhost:1024, but it is not getting connected. Can't we connect websockets to regular TCP server sockets?
user1608693
  • 31
  • 1
  • 2
1
vote
1 answer

Cannot establish proper server-client connection using websocket protocol

Goal: Establish working server-client connection based on websocket protocol between QTcpServer and C# client. For now, via localhost. Problem: Server works with telnet client but not with any other client (e.g. C# client, websocket test client…
anjelomerte
  • 286
  • 1
  • 9
1
vote
1 answer

Qt C++ unable to connect to QTcpServer using Telnet

I have watched VoidRealm's Youtube video, C++ Qt 67 - QTCPServer - a basic TCP server application and followed his instructions, however, I can't connect to the QTcpServer I created using Telnet. My Code: //myserver.h #ifndef MYSERVER_H #define…
1
vote
0 answers

Incomplete data in QDataStream when reading from QTcpSocket

So I have a strange issue that when I read data (QDataStream) on a QTcpSocket: some of the data seems to be missing. The bytesAvailable() function will return the proper amount of bytes to be read, but QDataStream doesn't seem to hold all the…
RBL92
  • 21
  • 3
1
vote
1 answer

QTcpServer/QTcpSocket: Using a QDataStream vs. sending UTF-8 data directly

I'm about to write a small server using QTcpServer which is intended to be connected by e. g. a telnet client. Only text will be sent. Qt's fortune cookie server example uses a QDataStream to send text via the following code using a…
Tobias Leupold
  • 1,512
  • 1
  • 16
  • 41
1
2
3
9 10