can not send/receive data while client and server are running on two different PCs.
-
Hello, All!
I am writing an App using QTcpSocket and there are 3 steps of communications between the client and server.
- first, client connects to server.
- second, client sends file data to server.
- third, server receives file data from client and feedback the write progress to client.
The strange thing is that all these 3 steps above are working correctly when client and server are running on the same pc. however, the first step can work normally and the other remaining 2 steps does not work while client and server are running two different PCs.
Is there anybody who has met the same problem?
-
Hello, All!
I am writing an App using QTcpSocket and there are 3 steps of communications between the client and server.
- first, client connects to server.
- second, client sends file data to server.
- third, server receives file data from client and feedback the write progress to client.
The strange thing is that all these 3 steps above are working correctly when client and server are running on the same pc. however, the first step can work normally and the other remaining 2 steps does not work while client and server are running two different PCs.
Is there anybody who has met the same problem?
-
Hello, All!
I am writing an App using QTcpSocket and there are 3 steps of communications between the client and server.
- first, client connects to server.
- second, client sends file data to server.
- third, server receives file data from client and feedback the write progress to client.
The strange thing is that all these 3 steps above are working correctly when client and server are running on the same pc. however, the first step can work normally and the other remaining 2 steps does not work while client and server are running two different PCs.
Is there anybody who has met the same problem?
-
-
@jsulm Yes, everytime client gets message from server, I will let client print some message to debugging console.
- client connects to server, server send feedback to client ->OK
- client send user information to server, server send feedback to client->OK
- client send filename to server ,sever send feedback to client->OK
- server makes the file in the local folder and send feedback to client->OK
- client continuously sends the bytes of the file to server, server is supposed to receive the bytes and writes them to the local file of the server , but server can not receive any bytes of data->FAIL!!!!!!!
-
@jsulm Yes, everytime client gets message from server, I will let client print some message to debugging console.
- client connects to server, server send feedback to client ->OK
- client send user information to server, server send feedback to client->OK
- client send filename to server ,sever send feedback to client->OK
- server makes the file in the local folder and send feedback to client->OK
- client continuously sends the bytes of the file to server, server is supposed to receive the bytes and writes them to the local file of the server , but server can not receive any bytes of data->FAIL!!!!!!!
-
@jgxy1123 said in can not send/receive data while client and server are running on two different PCs.:
sorry, I don't undestand what you mean
Are you coding the server app as well? Or only the client software? :)
(or at least have access to the server code) -
@jgxy1123 said in can not send/receive data while client and server are running on two different PCs.:
sorry, I don't undestand what you mean
Are you coding the server app as well? Or only the client software? :)
(or at least have access to the server code)@Pl45m4 I am writing both of client and server. I have found that server can receive data normally when client sends a small size of bytes(e.g, 1byte or 1024 bytes) each time . But when the size of data is bigger than 10240 bytes or 65536bytes, server can only receive some portion of data or no data at all. I found that other people on the internet have met the similar problem and they sovelved by setting the header of each data package, so server can understand how to cut the data each time. Unfourtunately, I can hardly understand their codes and what they are saying.
So, Is there any better or easy way to solve this kind of problem using Qt library or API ?
-
@Pl45m4 I am writing both of client and server. I have found that server can receive data normally when client sends a small size of bytes(e.g, 1byte or 1024 bytes) each time . But when the size of data is bigger than 10240 bytes or 65536bytes, server can only receive some portion of data or no data at all. I found that other people on the internet have met the similar problem and they sovelved by setting the header of each data package, so server can understand how to cut the data each time. Unfourtunately, I can hardly understand their codes and what they are saying.
So, Is there any better or easy way to solve this kind of problem using Qt library or API ?
@jgxy1123 said in can not send/receive data while client and server are running on two different PCs.:
But when the size of data is bigger than 10240 bytes or 65536bytes, server can only receive some portion of data or no data at all
So exactly 10 kB and 64 kB?!
Have you seen this?
Or this
server can only receive some portion of data or no data at all
What do you do exactly?
Unfourtunately, I can hardly understand their codes and what they are saying
If you dont understand how to do it and dont understand the code, start to learn :) Or move to some easier task
So, Is there any better or easy way to solve this kind of problem using Qt library or API ?
No API or Qt will manage how or when to send any raw data. This is up to you and you also need to handle it.
QTcpSocket
for example, tells you, when data was send or arrived or throw an error if any. Whether you send chunks of garbage, Qt cant tell ;-) -
@Pl45m4 I am writing both of client and server. I have found that server can receive data normally when client sends a small size of bytes(e.g, 1byte or 1024 bytes) each time . But when the size of data is bigger than 10240 bytes or 65536bytes, server can only receive some portion of data or no data at all. I found that other people on the internet have met the similar problem and they sovelved by setting the header of each data package, so server can understand how to cut the data each time. Unfourtunately, I can hardly understand their codes and what they are saying.
So, Is there any better or easy way to solve this kind of problem using Qt library or API ?
-
@jgxy1123 said in can not send/receive data while client and server are running on two different PCs.:
But when the size of data is bigger than 10240 bytes or 65536bytes, server can only receive some portion of data or no data at all
So exactly 10 kB and 64 kB?!
Have you seen this?
Or this
server can only receive some portion of data or no data at all
What do you do exactly?
Unfourtunately, I can hardly understand their codes and what they are saying
If you dont understand how to do it and dont understand the code, start to learn :) Or move to some easier task
So, Is there any better or easy way to solve this kind of problem using Qt library or API ?
No API or Qt will manage how or when to send any raw data. This is up to you and you also need to handle it.
QTcpSocket
for example, tells you, when data was send or arrived or throw an error if any. Whether you send chunks of garbage, Qt cant tell ;-) -