asio

What arguments do I pass to the client when running the boost::asio sockets examples

I am learning how to use the boost asio libraries and I am using the UDP examples on visual studio 2008. I have compiled and run the server application(name udp_server.exe). I have tried to run the client application but is does connect to the server. How do I specify the host and service name to the application for it to connect. I have...

boost::asio::async_read_until problem

Hi again, I'm modify the boost asio echo example to use async_read_until to read the input word by word. Even though I am using async_read_until all the data sent seems to be read from the socket. Could someone please advise: #include <cstdlib> #include <iostream> #include <boost/bind.hpp> #include <boost/asio.hpp> using boost::a...

Will Asio or Boost.Asio works in iPhone or Android?

Anyone know will Asio or Boost.Asio can be used in iPhone or Android development? I'm thinking to use it so I don't need to use difference network library for difference platform if it is cross platform. ...

boost::asio::async_write problem

Hi, I'm trying to figure out how asynchronous reads and writes work in boost asio by manipulating the echo example. Currently, I have a server that should, when sent a sentence, respond with only the first word. However, the boost::asio::async_write never seems to complete even though the write handler is being called. Can someone pl...

boost::asio handshake through http proxy?

quite new to boost and asio, need help connect to proxy asio::ip::tcp::socket socket_; send CONNECT host: ssl server to the proxy receive response 200 asio::ssl::context ctx(io_service, asio::ssl::context::sslv23); sslsocket_(socket_,context) try handshake sslsocket_.async_handshake(asio::ssl::stream_base::client, boost::bind(&clien...

boost::asio hangs in resolver service destructor after throwing out of io_service::run()

I'm using a fairly simple boost::asio set-up, where I call io_service.run() from the main thread. I have a tcp resolver, and use async resolve to look up an address. When that look-up fails, I throw an exception inside the asynchronous callback. I catch this exception outside the run() call, inside the main function. I then call stop() o...

Reading single byte with Asio::read

Hi. Is it possible to read a single byte via asio::read? I'm getting a single byte response and it seems wasteful to use the current buffering code: //Read the 1 byte reply char buffer[1]; size_t bytesRead = asio::read(s, asio::buffer(buffer, 1)); if(bytesRead < 1) return false; Thanks. ...

Setting TTL on outgoing ICMP packets?

Hi, I have been trying to set the TTL on ICMP packets using the boost::asio::ip::unicast::hops option (using Boost 1.43) and then reading it out with get_option. get_option gets 1 regardless what I use in set_option. And when inspecting the packets sent using wireshark, the TTL is 128. Am I missing something here? Should I use another ...

problem with some boost asio code

Ultimately I'm trying to transfer buffers from one machine to another. The code below takes stream of <id><size><data with size bytes> and reads the part in the handleReadHeader function, then reads the <size> number of bytes, then goes back and waits for another <id><size> pair. I've pasted a lot of code, but really the only functions...

boost deadline_timer question

I expected the code below to print Hello, world! every 5 seconds, but what happens is that the program pauses for 5 seconds and then prints the message over and over with no subsequent pauses. What am I missing? #include <iostream> #include <boost/asio.hpp> #include <boost/date_time/posix_time/posix_time.hpp> using namespace boost::as...

boost.asio. The possibility to expect the completion of any object in queue is necessary.

In asio:: io_service I insert objects. asio:: io_service::run() runs in several threads. The possibility to expect the completion of any object in queue is necessary. For example: template <typename T> struct handler { void operator()() { .... } T get() const {...} }; asio::io_service ios; ios.post(handler()); How I c...

boost.asio error on read from socket.

The following code of the client: typedef boost::array<char, 10> header_packet; header_packet header; boost::system::error_code error; ... /** send header */ boost::asio::write( _socket, boost::asio::buffer(header, header.size()), boost::asio::transfer_all(), error ); /** send body */ boost::asio::w...

Boost.Asio: Operation Cancelled on async_read

Another one in the continuing saga of myself vs. Boost.Asio... I have a simple asynchronous client and server that utilise async_write and async_read to communicate. The client can successfully write bytes to the socket, but the server never sees them; my read handler on the server fails with "Operation cancelled". I'm inclined to beli...

how to resolve ftp site using boost.asio?

Hello: Boost.asio documentation doesn't support any ftp examples. `boost::asio::io_service io_service; tcp::resolver resolver(io_service); tcp::resolver::query query("www.boost.org", "http"); tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);` that resolve http site and get an HTTP endpoint. but tcp::resolver::que...