Example #1
0
        public Client(string username)
        {
            this.username = username;
            this.fiber    = new PoolFiber();
            this.fiber.Start();
            this.peerListener = new PeerListener(username, this.OnConnectCallback);
            this.peer         = new PhotonPeer(this.peerListener, Settings.UseTcp ? ConnectionProtocol.Tcp : ConnectionProtocol.Udp);

            this.connectResetEvent = new AutoResetEvent(false);
        }
Example #2
0
        public Client(string username)
        {
            this.username = username;
            this.fiber = new PoolFiber();
            this.fiber.Start();
            this.peerListener = new PeerListener(username, this.OnConnectCallback);
            this.peer = new PhotonPeer(this.peerListener, Settings.UseTcp ? ConnectionProtocol.Tcp : ConnectionProtocol.Udp);

            this.connectResetEvent = new AutoResetEvent(false);
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Client"/> class.
        /// </summary>
        /// <param name="username">
        /// The username.
        /// </param>
        public Client(string username)
        {
            this.username = username;
            this.fiber    = new PoolFiber();
            this.fiber.Start();
            this.peerListener = new PeerListener(username, this.OnConnectCallback);
            this.peer         = new PhotonPeer(this.peerListener, Settings.UseTcp)
            {
                ChannelCount = 3
            };

            this.connectResetEvent = new AutoResetEvent(false);
        }
Example #4
0
 public static void ResetStats()
 {
     Interlocked.Exchange(ref exceptions, 0);
     Interlocked.Exchange(ref eventsReceivedSent, 0);
     Interlocked.Exchange(ref eventReceiveTimeFast, 0);
     Interlocked.Exchange(ref eventReceiveTimeMiddle, 0);
     Interlocked.Exchange(ref eventReceiveTimeSlow, 0);
     Interlocked.Exchange(ref eventReceiveTimeMax, 0);
     Interlocked.Exchange(ref eventsReceivedFast, 0);
     Interlocked.Exchange(ref eventsReceivedMiddle, 0);
     Interlocked.Exchange(ref eventsReceivedSlow, 0);
     Interlocked.Exchange(ref operationsSent, 0);
     PeerListener.ResetStats();
 }
Example #5
0
 private void OnConnectCallback(PeerListener obj, bool success)
 {
     this.connected = success;
     this.connectResetEvent.Set();
 }
Example #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Client"/> class.
        /// </summary>
        /// <param name="username">
        /// The username.
        /// </param>
        public Client(string username)
        {
            this.username = username;
            this.fiber = new PoolFiber();
            this.fiber.Start();
            this.peerListener = new PeerListener(username, this.OnConnectCallback);
            this.peer = new PhotonPeer(this.peerListener, Settings.UseTcp) { ChannelCount = 3 };

            this.connectResetEvent = new AutoResetEvent(false);
        }
Example #7
0
 private void OnConnectCallback(PeerListener obj, bool success)
 {
     this.connected = success;
     this.connectResetEvent.Set();
 }