Hi: I have a socket client running which has a char array of size 512 mentioned. I have a loop to receive the message from the server, when the loop exits I am getting the following error. Environment: Windows 64bit. VS 2010 Run-Time check failure #2 - Stack around the variable 'recMessage' was corrupted. Code: int STRLEN = 512; char recMessage[STRLEN] = "0"; ClientSocket sockClient; sockClient.ConnectToServer( ipAddress.c_str(), port ); sockClient.SendData("L|100=some_value;101=some_value\n"); sockClient.RecvData( recMessage, STRLEN ); int counter = 0 while(counter <= 10){ sockClient.RecvData( recMessage, STRLEN ); cout << recMessage << endl; counter++; } memset(recMessage,0,sizeof(char)*STRLEN); sockClient.CloseConnection();
Just wanted to confirm that the message I am receiving from the server is less than 200 characters in length.