initial commit
[raggin.git] / test_main.cpp
blob9483809af3b3d5c100b6a8909e52c1a3123d1f7d
1 #include <iostream>
2 #include <exception>
3 #include <vector>
4 #include <string>
5 #include <list>
6 #include <boost/asio.hpp>
7 // #include "src/socket.hpp"
8 #include "src/log.hpp"
9 // #include "src/session_container.hpp"
10 // #include "src/server/session.hpp"
11 #include <boost/shared_ptr.hpp>
12 #include <boost/uuid.hpp>
13 #include <boost/enable_shared_from_this.hpp>
15 using namespace std;
16 using namespace boost;
17 using namespace boost::asio::ip;
18 //using namespace raggin;
20 class Y;
21 typedef shared_ptr<Y> Yptr;
23 class Y : public enable_shared_from_this<Y>
25 public:
31 int main()
32 try
34 init_log();
36 asio::io_service io_service;
38 Yptr yp(new Y());
40 Yptr ptr = yp->shared_from_this();
43 asio::io_service io_service;
45 raggin::socket socket(io_service);
46 socket.accept(1337);
47 socket.send(asio::buffer("test!"));
49 vector<char> vecbuf(4);
50 socket.receive(asio::buffer(vecbuf));
51 cout << string(vecbuf.begin(), vecbuf.end()) << endl;
54 cin.get();
56 catch(exception& ex)
58 cerr << ex.what() << endl;
59 cin.get();