From fa4f4a8a50c4bab3a3e247fb7186a7f9a00dfc11 Mon Sep 17 00:00:00 2001 From: Othmar Gsenger Date: Mon, 3 Dec 2007 10:51:16 +0000 Subject: Added syncsocket --- syncSocket.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 syncSocket.cpp (limited to 'syncSocket.cpp') 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"); +} + -- cgit v1.2.3