Ejemplo n.º 1
0
        public virtual void Open()
        {
            if (IsOpened)
            {
                return;
            }

            if (Global.UseSyncContextPost && Global.SyncContext == null)
            {
                Global.SyncContext = SynchronizationContext.Current;
            }

            if (sendPortNumber != 0)
            {
                udpSender = new UDPSender(sendPortNumber, bufferSize);
            }

            if (listenPortNumber != 0)
            {
                udpReceiver            = new UDPReceiver(listenPortNumber, bufferSize);
                udpReceiver.OnReceive += OnUDPReceived;

                udpReceiver.Start();
            }


            IsOpened = true;
        }
Ejemplo n.º 2
0
        public virtual void Open()
        {
            if (IsOpened)
            {
                return;
            }

            if (Global.UseSyncContextPost && Global.SyncContext == null)
            {
                Global.SyncContext = SynchronizationContext.Current;
            }

            udpSender   = new UDPSender(sendPortNumber, bufferSize);
            udpReceiver = new UDPReceiver(listenPortNumber, bufferSize);

            tcpConnector = new TCPConnector(sendPortNumber);
            tcpConnector.ConnectionBufferSize   = bufferSize;
            tcpConnector.ConnectTimeOutMilliSec = connectTimeOutMilliSec;
            tcpConnector.OnConnected           += OnConnectedInternal;

            udpReceiver.OnReceive += OnUDPReceived;

            udpReceiver.Start();

            IsOpened = true;

            HealthCheck();
        }
Ejemplo n.º 3
0
        public void Open()
        {
            if (IsOpened)
            {
                return;
            }

            if (Global.UseSyncContextPost && Global.SyncContext == null)
            {
                Global.SyncContext = SynchronizationContext.Current;
            }

            udpSender   = new UDPSender(sendPortNumber, bufferSize);
            udpReceiver = new UDPReceiver(listenPortNumber, bufferSize);

            tcpListener = new TCPListener(listenPortNumber);
            tcpListener.ConnectionBufferSize = bufferSize;
            tcpListener.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
            tcpListener.OnConnected += OnConnectedInternal;

            beaconTimer = new System.Timers.Timer(BeaconIntervalMs);

            udpReceiver.OnReceive += OnUDPReceived;

            beaconTimer.Elapsed += OnBeaconTimer;

            tcpListener.Start();
            udpReceiver.Start();

            IsOpened = true;

            HealthCheck();
        }
Ejemplo n.º 4
0
        public virtual void Open()
        {
            if (IsOpened)
            {
                return;
            }

            udpSender   = new UDPSender(sendPortNumber, bufferSize);
            udpReceiver = new UDPReceiver(listenPortNumber, bufferSize);

            tcpConnector = new TCPConnector(sendPortNumber);
            tcpConnector.ConnectionBufferSize = bufferSize;
            tcpConnector.OnConnected         += OnConnectedInternal;

            udpReceiver.OnReceive += OnUDPReceived;

            udpReceiver.Start();

            IsOpened = true;

            HealthCheck();
        }