Originally Posted by
mcosta
Are you sure you're received bytes you need to readLine()?
Where do you set the code you check?
s.left(3).toInt()
s.left(3).toInt()
To copy to clipboard, switch view to plain text mode
Thanks for your reply.
But I'm not sure I understand what you mean ...
To read what the server says I use this signal/slot:
connect(tcpSocket, SIGNAL(readyRead()),this,SLOT(readHost()));
connect(tcpSocket, SIGNAL(readyRead()),this,SLOT(readHost()));
To copy to clipboard, switch view to plain text mode
Every time the server sends a message the readHost() function is called. Here's a piece of code:
switch(s.left(3).toInt()){
case 100:
t.append("request for help granted");
break;
case 200:
t.append("server ready to receive");
break;
switch(s.left(3).toInt()){
case 100:
t.append("request for help granted");
break;
case 200:
t.append("server ready to receive");
break;
To copy to clipboard, switch view to plain text mode
I only need the first 3 characters to determine the command it sends, so I strip everything from the message except the first 3 characters.
When I send "From: Vito" nothing happens, that seems normal to me because the string is not terminated by a "\n", but when I add a cr/lf the server responds with a '500' meaning it doesn't understand the message sent.
Maybe I don't use the right commands, that's possible, I got them from an older c-program and that worked fine a while ago on the same newsserver.
Bookmarks