Boost logo

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