I'm trying to develop an app that realises the communication between a gameserver and an applcation. My code so far is: #include <cstdlib> #include <iostream> #include <boost/bind.hpp> #include <boost/asio.hpp> #include <boost/asio/ssl.hpp> using namespace std; enum { max_length = 1024 }; class client { public: boost::asio::streambuf receive_buffer; client(boost::asio::io_service& io_service, boost::asio::ssl::context& context, boost::asio::ip::tcp::resolver::iterator endpoint_iterator) : socket_(io_service, context) { socket_.set_verify_mode(boost::asio::ssl::verify_peer); socket_.set_verify_callback( boost::bind(&client::verify_certificate, this, _1, _2)); boost::asio::async_connect(socket_.lowest_layer(), endpoint_iterator, boost::bind(&client::handle_connect, this, boost::asio::placeholders::error)); } bool verify_certificate(bool preverified, boost::asio::ssl::verify_context& ctx) { char subject_name[256]; X509* cert = X509_STORE_CTX_get_current_cert(ctx.native_handle()); X509_NAME_oneline(X509_get_subject_name(cert), subject_name, 256); return preverified; } void handle_connect(const boost::system::error_code& error) { if (!error) { socket_.async_handshake(boost::asio::ssl::stream_base::client, boost::bind(&client::handle_handshake, this, boost::asio::placeholders::error)); } else …

Member Avatar
Member Avatar
+0 forum 1

The problem is that i can't manage to compile the simplest (int main(){}) boost asio program with Code Blocks. I'm using Windows 7. Googling gave me some controversial suggestions: 1) to add -lwsock32 key - Done(Compiler settings->Other options-> -lwsock32) 2) to link with ws2_32.dll and wsock32.dll - Done (Linker settings->paths to these dlls) 3) to link with boost system lib - Done(Linker settings -> path to libboost_system-mgw47-mt-1_52.a) 4) to add _WIN32_WINNT=0x0601 for Windows 7 option - Done (Compiler settings->#defines _WIN32_WINNT=0x0601) 5) to include winsocks2.h as a header - Done. 6) to add option -std=gnu++11 - Done And still it doesn't …

Member Avatar
Member Avatar
+0 forum 2

Hello, I am currently trying to use boost asio for IPC. I ran into 2 strange issues: 1) when using the acceptor class, when I bring my process up, I get the error 'Already open' when trying to listen. The port I am trying to bind to is definitely not being used by another process. This only happens for a couple of my processes (others work fine). 2) when trying to establish a connection to a server (one that works fine from above), both processes receive the connection (and also disconnection when I kill one), but when I try to …

Member Avatar
Member Avatar
+0 forum 3

OK so I am not getting any sound on my computer right now - it is a Dell Latitude D630 and running XP service pack 3 (I believe). Point is, right now my computer does not recognize that I have any sound devices whatsoever. I had been messing with asio4all software and may have changed some settings that have now messed up my regular sound - I tried uninstalling the asio4all to hopefully force it to go back to normal, but of course it did not. I also tried re-downloading the driver, but it just told me that the hardware …

Member Avatar
+0 forum 0

[CODE]Server::Server(boost::asio::io_service& io_service,std::string ip,short port,std::shared_ptr<ConnectionFactory> factory) : acceptor_(io_service, boost::asio::ip::tcp::endpoint(boost::asio::ip::address_v4::from_string(ip.data()), port)){ m_factory = factory; start_accept(); std::cout<<"Socket accepting connections..."<<std::endl; } Server::~Server() { } void Server::start_accept(){ boost::asio::io_service io_service; std::shared_ptr<Connection> conn = m_factory->create(io_service); acceptor_.async_accept(conn->socket(), boost::bind(&Server::handle_accept, this,conn, boost::asio::placeholders::error)); } void Server::handle_accept(std::shared_ptr<Connection> conn,const boost::system::error_code& error){ if (!error) { std::cout<<"on connected"<<std::endl; conn->OnConnected(); start_accept(); } } [/CODE] when i run the project i got [CODE] Unhandled exception at 0x00c55c8c in AccountServer.exe: 0xC0000005: Access violation reading location 0xfeeeff02.[/CODE] and the call stack here > [CODE]AccountServer.exe!boost::asio::detail::win_iocp_io_service::register_handle(void * handle, boost::system::error_code & ec) Line 135 + 0x9 bytes C++[/CODE] so what's wrong here?!!

Member Avatar
Member Avatar
+0 forum 1

[CODE]class Connection { public: typedef boost::shared_ptr<Connection> pointer; static pointer create(boost::asio::io_service& io_service){return pointer(new Connection(io_service));} explicit Connection(boost::asio::io_service& io_service); virtual ~Connection(); boost::asio::ip::tcp::socket& socket(); -->>>virtual void OnConnected()=0; void Send(uint8_t* buffer, int length); bool Receive(); private: void handler(const boost::system::error_code& error, std::size_t bytes_transferred ); boost::asio::ip::tcp::socket socket_; };[/CODE] when am trying to use virtual void OnConnected()=0; it gives me this stupid error idk whats wrong!!! [CODE] 1 IntelliSense: object of abstract class type "Connection" is not allowed: d:\c++\ugs\accountserver\connection.h 17[/CODE] whats wrong and how can i fix it while in my old connection class it was working good!! [CODE]class Connection { public: explicit Connection(int socket); virtual ~Connection(); virtual …

Member Avatar
Member Avatar
+0 forum 1

is there is a tutorial about how to use boost:asio how to send how to recive , coz all the tutorials i checked is only showin me an example of server source or a client source. so please if there is one link me to it thnx alot :)

Member Avatar
+0 forum 0

I try to transmit an OpenCV IplImage from a Server (Ubuntu x64) to a Client (Win7 x64) The following code works fine if both (Client and Server) are on the same operating system. But when the server is on Ubuntu and the client on Win7 it doesn't work. The image header is correct, but something with the image data is wrong. I think this is because of the different bit-order between the two OS. How can I resolve this problem? And second: The transmission with this code is slow as hell :D . How can I improve the speed? Client: …

Member Avatar
Member Avatar
+0 forum 1

The End.