;)
I write a chat program with c++ server and java client.
The code of the function that responsible to receiving messages from the client is:
void *recieve(void* *v)
{
while (true)
{
bzero(buffer, 256);
n = read(socketfd, buffer, 256);
if (n < 0)
exit(1);
printf("Client: %s", buffer);
}
}
the code of the function thar responsible to send messages to the server is just:
ps.println(msg);
where ps is a printstream.
When I send a message to the server, say "hello world" the c++ server print: "Client: hello worldClient".
I would appreciate if someone could help me with this. (I apologize if my English is not good) thanks!