Hi everyone,
I took the daytime example and add a request this iostream, and
it starts deadlocking in windows environment. Is this the wrong way to do
it?
int main(int argc, char* argv[])
{
try
{
if (argc != 2)
{
std::cerr << "Usage: daytime_client <host>" << std::endl;
return 1;
}
tcp::iostream s(argv[1], "daytime");
s << "request";
std::string line;
std::getline(s, line);
std::cout << line << std::endl;
}
catch (std::exception& e)
{
std::cout << "Exception: " << e.what() << std::endl;
}
return 0;
}
void
server()
{
try
{
boost::asio::io_service
io_service;
tcp::endpoint endpoint(tcp::v4(), 13);
tcp::acceptor acceptor(io_service, endpoint);
for (;;)
{
tcp::iostream stream;
acceptor.accept(*stream.rdbuf());
std::string req;
stream
>> req;
stream << make_daytime_string();
}
}
catch (std::exception& e)
{
std::cerr << e.what()
<< std::endl;
}
}
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. Get busy.