boost-asio

Compare boost::system::error_category

爱⌒轻易说出口 提交于 2020-01-24 20:59:46
问题 The following comparison fails for an error whom outputs "asio.misc" for errorCode.category().name() and "end of file" for errorCode.message() If it claims to be in category asio.misc, then why does the if condition of (errorCode.category() == boost::asio::error::misc_category ) evaluate to false? Googling (including answers here) says that a boost::system::error_code can have the same value in more than one category, so I assume that in order to get the proper message and meaning we must

udp client sever changing from pull model to push model [closed]

◇◆丶佛笑我妖孽 提交于 2020-01-24 12:58:50
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I have implemented udp_client and 'udp_server` where server and client follows a pull model. The server pushes the data only when the client requests it. I want to change this to push model where server pushes the data down to the client when data is available. My source files, header files and make is given

boost::asio::deadline_timer::async_wait not firing callback

独自空忆成欢 提交于 2020-01-23 12:07:28
问题 I have a boost io_service running in a thread, and I would like to fire a callback in that thread 6 seconds after a certain event happens to a client, and reset the timer for that client if it is already running. I maintain a unordered_map<string, shared_ptr<deadline_timer>> with a timer for each client. However, upon setting async_wait , my callback does not fire after the alloted amount of time (the io_service IS running), neither does it fire (with an error code) when I reset the pointer

Boost Asio - Server doesn't receive message

青春壹個敷衍的年華 提交于 2020-01-23 09:50:30
问题 I'm developing a 3d (first/third person) game and I'm trying to make it multiplayer using TCP sockets. I'm using the boost asio library for this, and I'm in a little over my head. I've played with the tutorials and examples a bit on the boost asio doc page and they compiled/ran/worked just fine, I'm just a little confused as to how everything works. Right now I'm just trying to make the server accept messages from the client, and print the message after receiving it. When I execute the code

Why boost::asio::async_read completion sometimes executed with bytes_transferred=0 and ec=0?

偶尔善良 提交于 2020-01-23 09:26:06
问题 Recently I have found an annoying problem with boost:asio::async_read . When I transfer large amounts of data, say a file of about 9GB, boost:asio::async_read works well in most of the time, but sometimes the completion of async_read is executed with bytes_transferred=0 and ec=0! And sometimes the completion of async_read is executed with bytes_transferred!=sp_recv_data->size() and ec still equal to 0. My code just like below: void CNetProactorClientImpl::async_recv() { auto sp_vec_buf = make

boost asio acceptor.accept invalid argument

大兔子大兔子 提交于 2020-01-16 18:01:32
问题 i am trying to code with boost asio in socket programming. after setting boost in my ubuntu eclipse environment, i tried the sample code in boost web site. but an error occur on acceptor.accept() function with invalid argument, like below how can i fix this error ? Invalid arguments ' Candidates are: void accept(boost::asio::basic_socket<#10000,#10001> &, std::enable_if<&0[std::is_convertible<boost::asio::ip::tcp,#10000>::value],void>::type *) boost::system::error_code accept(boost::asio:

boost asio acceptor.accept invalid argument

荒凉一梦 提交于 2020-01-16 18:01:24
问题 i am trying to code with boost asio in socket programming. after setting boost in my ubuntu eclipse environment, i tried the sample code in boost web site. but an error occur on acceptor.accept() function with invalid argument, like below how can i fix this error ? Invalid arguments ' Candidates are: void accept(boost::asio::basic_socket<#10000,#10001> &, std::enable_if<&0[std::is_convertible<boost::asio::ip::tcp,#10000>::value],void>::type *) boost::system::error_code accept(boost::asio:

boost asio acceptor.accept invalid argument

微笑、不失礼 提交于 2020-01-16 18:01:19
问题 i am trying to code with boost asio in socket programming. after setting boost in my ubuntu eclipse environment, i tried the sample code in boost web site. but an error occur on acceptor.accept() function with invalid argument, like below how can i fix this error ? Invalid arguments ' Candidates are: void accept(boost::asio::basic_socket<#10000,#10001> &, std::enable_if<&0[std::is_convertible<boost::asio::ip::tcp,#10000>::value],void>::type *) boost::system::error_code accept(boost::asio:

Boost asio - async reading established number of chars from stdin

吃可爱长大的小学妹 提交于 2020-01-16 07:15:28
问题 I wanna write boost::asio app which is reading from stdin with boost::asio::streambuf. Anyway the only function which works on streambuf made from STDIN_FILENO is boost::asio::async_read_until. The other ones throws errors. Is there any possibility to read 100 first character from stdin with boost asio function? 回答1: In principle this just works #include <boost/asio.hpp> #include <boost/asio/posix/stream_descriptor.hpp> using namespace boost::asio; using boost::system::error_code; #include

serial port configuration using boost ASIO

。_饼干妹妹 提交于 2020-01-15 14:24:21
问题 I am configuring serial port using boost asio. but why below code is giving error? If I comment set_option it works fine. below code gives error serial_config.cpp:13: error: expected unqualified-id before numeric constant In file included from /home/chirag/boost_install/include/boost/asio/serial_port_service.hpp:25, from /home/chirag/boost_install/include/boost/asio/basic_serial_port.hpp:30, from /home/chirag/boost_install/include/boost/asio.hpp:25, from serial_config.cpp:1: /home/chirag