Пример #1
0
        public void Connect(ISledTarget target)
        {
            var tcpTarget = target as SledTcpTarget;

            if (tcpTarget == null)
            {
                throw new InvalidOperationException("target is not a TcpTarget");
            }

            m_socket                     = new TargetTcpSocket(1000);
            m_socket.Connected          += SocketConnected;
            m_socket.Disconnected       += SocketDisconnected;
            m_socket.DataReady          += SocketDataReady;
            m_socket.UnHandledException += SocketUnHandledException;

            try
            {
                m_socket.Connect(tcpTarget);
            }
            catch (Exception ex)
            {
                if (UnHandledExceptionEvent != null)
                {
                    UnHandledExceptionEvent(this, ex);
                }
            }
        }
Пример #2
0
        public void Connect(ISledTarget target)
        {
            var tcpTarget = target as SledTcpTarget;
            if (tcpTarget == null)
                throw new InvalidOperationException("target is not a TcpTarget");

            m_socket = new TargetTcpSocket(1000);
            m_socket.Connected += SocketConnected;
            m_socket.Disconnected += SocketDisconnected;
            m_socket.DataReady += SocketDataReady;
            m_socket.UnHandledException += SocketUnHandledException;

            try
            {
                m_socket.Connect(tcpTarget);
            }
            catch (Exception ex)
            {
                if (UnHandledExceptionEvent != null)
                    UnHandledExceptionEvent(this, ex);
            }
        }