Exemplo n.º 1
0
        private void btnImportCSV_Click(object sender, EventArgs e)
        {
            DataSourceForm dataForm = new DataSourceForm();

            if (dataForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            m_multiIpAddress = dataForm.m_strIP;
            m_multiIpPort    = int.Parse(dataForm.m_strPort);
            m_strODFPath     = dataForm.m_strPath;

            if (!backgroundWorker_udp.IsBusy)
            {
                backgroundWorker_udp.RunWorkerAsync();
            }
        }
Exemplo n.º 2
0
        private void btnImportCSV_Click_tcp()
        {
            DataSourceForm dataForm = new DataSourceForm();

            if (dataForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string strIp   = dataForm.m_strIP;
            string strPort = dataForm.m_strPort;
            string strPath = dataForm.m_strPath;

            if (strIp == string.Empty || strPort == string.Empty || strPath == string.Empty)
            {
                return;
            }


            try
            {
                tc = new TcpClient();
                tc.Connect(new IPEndPoint(IPAddress.Parse(strIp), Int32.Parse(strPort)));
                bTcpIsConnect = tc.Connected;
                if (bTcpIsConnect)
                {
                    MessageBox.Show("Connected Successfully");
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            recThread = new Thread(new ThreadStart(ThreadReceive));
            recThread.Start();
        }