summaryrefslogtreecommitdiff
path: root/syncSocket.cpp
diff options
context:
space:
mode:
authorOthmar Gsenger <otti@anytun.org>2007-12-03 10:51:16 +0000
committerOthmar Gsenger <otti@anytun.org>2007-12-03 10:51:16 +0000
commitfa4f4a8a50c4bab3a3e247fb7186a7f9a00dfc11 (patch)
tree5ff84c3c71e6d3dadbaf9e13d3fdd84ab2691ca6 /syncSocket.cpp
parentadded ssl tools (diff)
Added syncsocket
Diffstat (limited to 'syncSocket.cpp')
-rw-r--r--syncSocket.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/syncSocket.cpp b/syncSocket.cpp
new file mode 100644
index 0000000..36c02b5
--- /dev/null
+++ b/syncSocket.cpp
@@ -0,0 +1,37 @@
+
+#include "Sockets/Utility.h"
+#include "syncSocket.h"
+
+
+SyncSocket::SyncSocket(ISocketHandler& h)
+:TcpSocket(h)
+{
+ // initial connection timeout setting and number of retries
+ SetConnectTimeout(12);
+ SetConnectionRetry(5);
+
+ // Also reconnect broken link
+ SetReconnect(true);
+}
+
+
+bool SyncSocket::OnConnectRetry()
+{
+ return true;
+}
+
+
+void SyncSocket::OnReconnect()
+{
+ // ...
+ Send("Welcome back\r\n");
+}
+
+void SyncSocket::OnAccept()
+{
+ Send("Local hostname : " + Utility::GetLocalHostname() + "\n");
+ Send("Local address : " + Utility::GetLocalAddress() + "\n");
+ Send("Number of sockets in list : " + Utility::l2string(Handler().GetCount()) + "\n");
+ Send("\n");
+}
+