Reputation: 151
I have a QLocalserver where I read data sent by a non QT client. The data is sent after receiving some keyevents. This means if I press some key, the data is sent through localsocket to server and I have to perform some action in my server.
Now it happens at times that the data does not reach the server even when the return value of sendto is +ve value i.e. success. The data is received only when any other key is pressed even though if I am not sending the data to socket after that.
I am reading for all bytes till end in while loop in my readyread slot, but stil don't know what the problem is. Can anyone help me in figuring this out. Is this related to ready read signal genration or some scheduling problem.
The Ready read slot is as below
void MainWindow::ReadyRead(void)
{
char cmd[sizeof( struct Data)];
struct Data *Rcv;
while(ui->client->bytesAvailable())
{
ui->client->read(cmd, sizeof(struct Data));
Rcv= ( struct Data *)cmd;
CommandParser(Rcv);
}
}
Upvotes: 0
Views: 255
Reputation: 1343
W/o some piece of code it's hard to cleary say whats wrong, I've some assumptions:
A piece of code would be appreciated, though.
Upvotes: 0