
11 Aug
2009
11 Aug
'09
10:48 a.m.
for (;;){ char szBuf [BUF_LEN]; boost::system::error_code error; uInt uiBytes_Recv = socket.read_some(boost::asio::buffer(szBuf), error); std::cout << " Read " << uiBytes_Recv << " bytes" << std::endl; if (error == boost::asio::error::eof) break; // Connection closed cleanly by peer. else if (error) throw boost::system::system_error(error); // Some other error.
memcpy((void*) szTmp_Buf, (void*) szBuf, uiBytes_Recv ); szTmp_Buf[ uiBytes_Recv ] = '\0'; szDest += szTmp_Buf; };
You receive function looks like it never exits -- until some error occurs or the socket is closed. Was this the intent (or am I missing something)?