What happens when you change your code to this?
char buf[512] = "";
CSocket tsock;
if ( hsock.Accept(tsock) == 0 )
{[INDENT]// Error
return;[/INDENT]}
while (1)
{[INDENT]int bytes = tsock.Receive(buf,sizeof(buf),0);
if ( bytes == 0 ) // No data read. Close the Socket.
{[INDENT]break;[/INDENT]}
if ( bytes == SOCKET_ERROR )
{[INDENT]AfxMessageBox("Error";
break;[/INDENT]}
AfxMessageBox(buf);[/INDENT]}
tsock.Close();
WolfPack
Postaholic
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115