creaImageIOPACSConnection.cpp

Go to the documentation of this file.
00001 
00002 #include <creaImageIOPACSConnection.h>
00003 #include <cstdlib>
00004 #include <cstring>
00005 #include <iostream>
00006 //#include <boost/asio.hpp>
00007 
00008 //using boost::asio::ip::tcp;
00009 
00010 enum { max_length = 3086 };
00011 using namespace std; 
00012 namespace creaImageIO
00013 {
00014         PACSConnection::PACSConnection(std::string command)
00015         {
00016         /*
00017         try
00018         {
00019 
00020                 boost::asio::io_service io_service;
00021 
00022                 tcp::resolver resolver(io_service);
00023                 tcp::resolver::query query(tcp::v4(), "localhost", "3306");
00024                 tcp::resolver::iterator iterator = resolver.resolve(query);
00025 
00026                 tcp::socket s(io_service);
00027                 s.connect(*iterator);
00028 
00029                 size_t request_length = strlen(command.c_str());
00030                 boost::asio::write(s, boost::asio::buffer(command.c_str(), request_length));
00031 
00032                 char reply[max_length];
00033                 size_t reply_length = boost::asio::read(s,
00034                         boost::asio::buffer(reply, request_length));
00035                 std::cout << "Reply is: ";
00036                 std::cout.write(reply, reply_length);
00037                 std::cout << "\n";
00038         }
00039         catch (std::exception& e)
00040         {
00041                 std::cerr << "Exception: " << e.what() << "\n";
00042         }
00043         */
00044         }
00045         
00046 }
00047 
00048 
00049