Beispiel #1
0
 internal void OnClientDisconnect(ClientConnectionEventArgs args)
 {
     try {
         if (ClientDisconnected != null)
             ClientDisconnected(this, args);
     } finally {
         if (connections != null && connections.ContainsKey(args.RemoteEndPoint)) {
             connections.Remove(args.RemoteEndPoint);
             if (connections.Count == 0)
                 connections = null;
         }
     }
 }
Beispiel #2
0
        internal bool Connect(bool authorized)
        {
            started = DateTime.Now;

            try {
                ClientConnectionEventArgs args = new ClientConnectionEventArgs(protocol, LocalEndPoint, remoteEndPoint, authorized);
                authorized = service.OnClientConnect(args);
                connected = true;
                return authorized;
            } catch (Exception) {
                connected = false;
                return false;
            }
        }
Beispiel #3
0
        internal bool OnClientConnect(ClientConnectionEventArgs args)
        {
            if (ClientConnected != null)
                ClientConnected(this, args);

            return args.Authorized;
        }
Beispiel #4
0
        internal void Disconnect()
        {
            ClientConnectionEventArgs args = new ClientConnectionEventArgs(protocol, LocalEndPoint, remoteEndPoint, started);

            try {
                service.OnClientDisconnect(args);
            } finally {
                ended = DateTime.Now;
                connected = false;
            }
        }