summaryrefslogtreecommitdiff
path: root/src/muxSocket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/muxSocket.cpp')
-rw-r--r--src/muxSocket.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/muxSocket.cpp b/src/muxSocket.cpp
new file mode 100644
index 0000000..0e0a43f
--- /dev/null
+++ b/src/muxSocket.cpp
@@ -0,0 +1,49 @@
+#include <sstream>
+#include <iostream>
+#include <fstream>
+#include <string>
+
+#include "anymuxOptions.h"
+
+#include "Sockets/Utility.h"
+#include "muxSocket.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();
+//}