Answer the question
In order to leave comments, you need to log in
What's wrong with Boost.Asio?
Did everything according to John Torjo's book - Boost.Asio C++ Network Programming, what's wrong?
Tried to turn off the firewall, still throws an incomprehensible error.
int main()
{
using namespace boost::asio;
io_service service;
ip::tcp::endpoint endp(ip::address::from_string("127.0.0.1"), 2001);
ip::tcp::socket sock(service);
try {
sock.connect(endp);
}
catch (boost::system::system_error error) {
std::cout << error.what() << std::endl;
}
}
Answer the question
In order to leave comments, you need to log in
To display the message in a normal way, try executing the command chcp 1251
before starting the program. Or you can change the default encoding in the registry, as done here .
Regarding the error itself: in Windows, by default, ports are divided into two groups, working with which requires different rights (in fact, everything is more complicated there, but I don’t remember the details). Try increasing the port number, something like 51501. Or run it with administrator rights to check. This may not be your problem, but I have experienced this.
EDIT: If it doesn't work with encodings, print the error number and search for it, boost allows you to do this. Well, let me remind you that for the client to work, you must first start the server, otherwise you never know.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question