samedi 18 avril 2015

C++ Server reply properly

I want to make a Server that reply to my Sockets. I have a code like this:



#define DEFAULT_BUFLEN 512

/*...*/
int iResult;
int iSendResult;
char recvbuf[DEFAULT_BUFLEN];
int recvbuflen = DEFAULT_BUFLEN;

/*...*/

iResult = recv(ClientSocket, recvbuf, recvbuflen, 0);
if (recvbuf == "hello"){
iSendResult = send(ClientSocket, "Hi Client", iResult, 0);

}else {printf("[ERROR]Unexpected Socket.\n"); }


Now, it doesn't work. and I don't now why. I try to searck something online (whit poor results). How can I make it works? I'm willing to change all the code.


Aucun commentaire:

Enregistrer un commentaire