visual c++ - How would I make Send execute before Receive in Boost -



visual c++ - How would I make Send execute before Receive in Boost -

note: using microsoft visual c++ 2010 express.

as title describes, having problem socket.send , socket.receive. socket.receive keeps wanting execute before socket executes send:

using boost::asio::ip::tcp; boost::asio::io_service io_service; boost::system::error_code closesock; tcp::resolver resolver(io_service); tcp::resolver::query query("127.0.0.1", "11113"); tcp::resolver::iterator endpoint_iterator = resolver.resolve(query); tcp::socket socket(io_service); boost::asio::connect(socket, endpoint_iterator); boost::asio::streambuf recvbuf; boost::asio::streambuf::mutable_buffers_type recvbuff = recvbuf.prepare(256); const char* sndbuf = "this buffer"; string sendbuff = sndbuf; socket.send(boost::asio::buffer(sendbuff)); //this should execute first , finish first socket.receive(boost::asio::buffer(recvbuff)); //this should execute sec , finish sec

so basically, function keeps waiting receive first before send. want sends first, receives after send finished.

ps: sorry if duplicate, i've looked everywhere solve problem.

anyways, morning :)

visual-c++

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -