Server sending gibberish to the client.
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
Code:
socket->write("Hello Client! Meassage from Server!");
but when i do this
Code:
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 function to read data from the socket on the client side. Any help will be appreciated.
Re: Server sending gibberish to the client.
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?