Sending empty strings, prints messages on server

This commit is contained in:
Pontus Fransson 2013-11-20 10:33:52 +01:00
parent 58efe7fdd3
commit 5bcc285141
2 changed files with 6 additions and 0 deletions

View File

@ -70,6 +70,10 @@ void chat(Client client)
if(msgSend != "exit") if(msgSend != "exit")
{ {
if(strlen(msgSend) < 1)
{
strcpy_s(msgSend, "ERROR");
}
client.Send(msgSend); client.Send(msgSend);
} }

View File

@ -40,9 +40,11 @@ int main()
while(1) while(1)
{ {
client1.Recv(recvBuffer); client1.Recv(recvBuffer);
cout << "Client1: " << recvBuffer << endl;
client2.Send(recvBuffer); client2.Send(recvBuffer);
client2.Recv(recvBuffer); client2.Recv(recvBuffer);
cout << "Client2: " << recvBuffer << endl;
client1.Send(recvBuffer); client1.Send(recvBuffer);
} }