C++ sockets connecting to C# server
See the question and my original answer on StackOverflowYou could do something like this:
...
iResult = recv(ConnectSocket, recvbuf, recvbuflen, 0);
recvbuf[iResult] = 0; // add this to zero terminate the receive buffer
std::cout << recvbuf <<std::endl;
...
(of course it assumes iResult is lesser than DEFAULT_BUFLEN)