Monday, July 1, 2013

boost::asio write_some - error

Newsgroup: comp.lang.c++

Subject: boost::asio write_some - error

From: Przemek Biernat <Biernat.Przemyslaw@...>

Date: Mon, 1 Jul 2013 09:33:20 -0700 (PDT)



I have some problem with send data by boost::asio. My code:



void Connection::SendCommand(std::shared_ptr<ICommand> command)

{

int dataSize = command->GetSize();



vector<char> dataBuffer = vector<char>(dataSize);



stringstream ss;

binary_oarchive oa(ss);

command->Serialize(oa);



if(_side == Server)

command->Execute();



binary_iarchive ia(ss);



ia.load_binary(&dataBuffer[0], dataSize);



int* header = new int[3];



header[0] = (int)(command->Type());

header[1] = (int)FromClientToServer;

header[2] = dataSize;



size_t s = _socket->write_some(buffer(header, 3*sizeof(int)));

size_t s1 = _socket->write_some(buffer(dataBuffer, dataSize*sizeof(char)));



delete[] header;

}



I get exception on the second call write_some:



boost::exception_detail::clone_impl<boost::excepti on_detail::error_info_injector<boost::system::syst em_error> > at memory location 0x0021F520.



Does anybody know what is wrong?







via Usenet Forums - Usenet Search,Free Usenet - comp.lang.c++ http://www.pocketbinaries.com/usenet-forums/showthread.php?32879-boost-asio-write_some-error&goto=newpost

View all the progranning help forums at:

http://www.pocketbinaries.com/usenet-forums/forumdisplay.php?128-Coding-forums

No comments:

Post a Comment