summaryrefslogtreecommitdiff
path: root/src/anyCtrSocket.cpp
blob: d3bec07cccf13a5e38fcd9776117be265c835f80 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <sstream>
#include <iostream>
#include <fstream>
#include <string>

#include "anyCtrOptions.h"

#include "Sockets/Utility.h"
#include "anyCtrSocket.h"


#ifdef SOCKETS_NAMESPACE
using namespace SOCKETS_NAMESPACE;
#endif // SOCKETS_NAMESPACE


MuxSocket::MuxSocket(ISocketHandler& h) : TcpSocket(h), filename_(gOpt.getFileName())
{
	SetConnectTimeout(12);
}


void MuxSocket::OnAccept()
{
  std::ifstream file(filename_.c_str());
  if( file.is_open() )
  {
    std::string line;
    while( !file.eof() )
    {
      getline( file, line );
      Send( line );
    }
    file.close();
  }

	//TODO Locking here
}

//void StatusSocket::InitSSLServer()
//{
//	InitializeContext("server.pem", "keypwd", SSLv23_method());
//}
//
//
//void StatusSocket::Init()
//{
//	EnableSSL();
//}