Пример #1
0
        public void Connect()
        {
            m_SerialPort.Open();

            parent.UpdateStatus();
            parent.PostMessage("Successfully connected to motors.");
        }
Пример #2
0
        public void Connect()
        {
            try
            {
                m_SerialPort.Open();
                parent.PostMessage("Successfully connected to motors.");
            }
            catch (Exception ex)
            {
                parent.PostMessage("COM1 open error:" + ex.ToString());
            }

            parent.UpdateStatus();
        }
Пример #3
0
        public void Connect(IPAddress address)
        {
            m_Address = address;

            try
            {
                m_Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                m_Socket.Connect(new IPEndPoint(address, 48888));

                m_NetworkStream = new NetworkStream(m_Socket);
                m_NetworkStream.BeginRead(m_ReadBuffer, 0, READ_BUFFER_SIZE, m_cbDataRead, null);

                parent.PostMessage("Successfully connected to robot host.");
            }
            catch (Exception ex)
            {
                parent.PostMessage("Error connecting to robot host.\r\n  " + ex.Message);

                m_Socket        = null;
                m_NetworkStream = null;
            }

            parent.UpdateStatus();
        }