예제 #1
0
        public virtual void Close()
        {
            if (!IsOpened)
            {
                return;
            }

            Disconnect();

            udpReceiver.Close();

            tcpConnector = null;
            udpReceiver  = null;
            udpSender    = null;

            IsOpened = false;
        }
예제 #2
0
        public virtual void Close()
        {
            if (!IsOpened)
            {
                return;
            }

            if (listenPortNumber != 0)
            {
                udpReceiver.Close();
                udpReceiver = null;
            }
            if (sendPortNumber != 0)
            {
                udpSender = null;
            }

            IsOpened = false;
        }
예제 #3
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();
        }