I do not understand, how void* function can be with return value. Code below, its work.
void *TcpClient::receive(int size=512)
{
char *buffer = new char[size];
if (recv(_sockfd , buffer , sizeof(buffer) , 0) < 0)
{
std::cerr << "recv failed";
}
return buffer;
}
The function returns void*
, i.e. the pointer to memory, not void
.