/// <summary>
 /// Constructor that initializes Joined object based on given TCPSettings.
 /// </summary>
 /// <param name="c">TCPSettings for Joined work.</param>
 public Joined(TCPSettings c)
 {
     ts = c;
     msBeforeTimeOut = ts.msTimeout;
     clientH         = new WatsonTcpClient(ts.ip, ts.port);
     clientH.Events.ServerConnected    += JoinedConnected;
     clientH.Events.ServerDisconnected += JoinedDisconnected;
     clientH.Events.StreamReceived     += StreamReceived;
     //clientH.Events.MessageReceived += MessageReceived;
     //clientH.Callbacks.SyncRequestReceived = SyncRequestReceived;
     FileScan(ts.directoryPath);
     clientH.Connect();
 }
Beispiel #2
0
        /// <summary>
        /// Constructor that initializes Host object based on given TCPSettings.
        /// </summary>
        /// <param name="c">TCPSettings for Host work.</param>
        public Host(TCPSettings c)
        {
            ts = c;
            msBeforeTimeOut = ts.msTimeout;
            servH           = new WatsonTcpServer(ts.ip, ts.port);
            servH.Events.ClientConnected        += JoinedConnected;
            servH.Events.ClientDisconnected     += JoinedDisconnected;
            servH.Events.StreamReceived         += StreamReceived;
            servH.Callbacks.SyncRequestReceived += SyncSolver;

            servH.Keepalive.EnableTcpKeepAlives    = true;
            servH.Keepalive.TcpKeepAliveInterval   = 10;
            servH.Keepalive.TcpKeepAliveTime       = msBeforeTimeOut;
            servH.Keepalive.TcpKeepAliveRetryCount = 10;

            FileScan(ts.directoryPath);
            servH.Start();
            UIHandler.WriteLog($"Host started!", Color.Green);
        }