PDA

View Full Version : Server sending gibberish to the client.



ayanda83
12th May 2013, 14:20
I'm coding this client/server application for chatting. My client is able to send messages to the server, so is the server to the client but, messages from server to client can only be sent in this form
socket->write("Hello Client! Meassage from Server!"); but when i do this
QByteArray clientMsg;
clientMsg.append(("Hello Client! Meassage from Server!") the client displays some ascii gabbage. what is coursing this? am i doing something wrong? The reason for me wanting to use the second method is that I want to take a message from one client application and relay it to another client via the server. But the way I am using the
readAll() function to read data from the socket on the client side. Any help will be appreciated.

wysota
12th May 2013, 18:00
What do you do with "clientMsg" after the lines of code that you posted? How do you feed it to the socket? How are you reading data on the other end? Are you expecting the whole message to come in one piece or do you have any marks that let you determine that you have received the whole message?