|
Boost Users : |
Subject: Re: [Boost-users] Synchronous problem with asio
From: Igor R (boost.lists_at_[hidden])
Date: 2009-08-11 06:48:31
> Â Â 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)?
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net