I am trying to this: my client socket sends a message to my server socket, then the server socket receives the message and wants to know if it got the desired message. For instance:
msg_client == "Hello" ---> print client message
msg_client != "Hello" ---> print error
Code below is the part of the server socket code, that supposed to do the thing above, but it does not, it just print the client message if I quit the "IF" condition, but I need the condition.
How do I compare the client message with another message into a IF condition?
Server code
recv(connfd, msg , 1035 , 0);
if(msg == "Client_Server_1"){
printf("Who is sending metadata: %s\n", msg);
}
Part of client code sending message
char *id = "Client_Server_1";
send(sock , id , strlen(id) , 0);
Thank you in advanced
Aucun commentaire:
Enregistrer un commentaire