summaryrefslogtreecommitdiff
path: root/syncSocket.cpp
diff options
context:
space:
mode:
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");
+}
+