Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jun 13th, 2011  |  syntax: C++  |  size: 1.04 KB  |  views: 104  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #pragma once
  2.  
  3. #include <boost/bind.hpp>
  4. #include <boost/asio.hpp>
  5.  
  6. using boost::asio::ip::tcp;
  7.  
  8. class session
  9. {
  10. public:
  11.  
  12.         session(boost::asio::io_service& io_service);
  13.         session::~session();
  14.  
  15.         tcp::socket& socket();
  16.  
  17.         void start();
  18.  
  19. private:
  20.  
  21.         void handle_read(const boost::system::error_code& error,
  22.                 size_t bytes_transferred);
  23.  
  24.         void handle_write(const boost::system::error_code& error,
  25.                 size_t bytes_transferred);
  26.  
  27.         void handle_sqlserver_connect(const boost::system::error_code& error,
  28.                 tcp::resolver::iterator endpoint_iterator);
  29.  
  30.         void handle_sqlserver_read(const boost::system::error_code& error,
  31.                 size_t bytes_transferred);
  32.  
  33.         void handle_sqlserver_write(const boost::system::error_code& error,
  34.                 size_t bytes_transferred);
  35.  
  36. private:
  37.  
  38.         tcp::socket socket_;
  39.         tcp::socket sqlsocket_;
  40.  
  41.         tcp::resolver resolver;
  42.  
  43.         enum { max_length = 8192 };
  44.         boost::array<char, max_length> buf;
  45.         boost::array<char, max_length> sqlbuf;
  46.  
  47.         std::string user;
  48.         std::string pass;
  49.         std::string dbserver;
  50.         std::string database;
  51. };
clone this paste RAW Paste Data