tags:

views:

584

answers:

1

I've been trying to achieve that for the better part of the day, I'd honestly apreciate any help. Both of my apps, the client and the server started throwing "vector subscript out of range" exceptions.

How does one do this thing properly ?


Still trying to figure this out, anyone?

As far as I undestand I'm supposed to create a

boost::asio::basic_stream_socket stream; And then call :

stream.send(boost::asio::buffer(data)); ?

I suppose it's perfectly possible to do it asynchronously ? What are the differences between : basic_stream_socket::send() vs. basic_stream_socket::write_some() vs. basic_stream_socket::async_write_some() ?

basic_stream_socket::receive() vs. baic_stream_socket::read_some() vs. basic_stream_socket::async_read_some() ?

I'm assuming that send() & receive() are methods that I can call when I wish to make sure that 100% of data is sent/received - at the expense of blocking the socket?

I'm assuming that write_some() & read_some() are methods that I can call when I'm not sure if 100% of data is sent/received - while still blocking the socket ?

I'm assuming that async_read_some() & async_write_some() are methods that don't block the socket and they read/write whatever they can ?

+2  A: 

Assuming you created a stream and are trying to send the vector<char> data:

stream.send(boost::asio::buffer(data));

See boost:asio::buffer.

Judge Maygarden