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); } } }
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); } }