ITC81DB_2H/ITC81DB_0H/Datastore/Ethernet.cs

166 lines
5.0 KiB
C#

using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Net.Sockets;
using System.IO;
using System.Threading;
using SmartX;
namespace ITC81DB_0H
{
public class Ethernet
{
//#region Field
//private int m_EthernetPort;
//private string m_EthernetAddress;
//public bool IsStop;
//private TcpClient CurrentTcpClient;
//private NetworkStream CurrentNetStream = null;
//private StreamReader CurrentStmReader = null;
//private StreamWriter CurrentStmWriter = null;
//private delegate void TransferDataCollbaack(string strtext);
//private delegate void TextStatusCallback(string strtext);
//private delegate void UIControlCallback(bool bEnable);
//private delegate void UIServerStatusCallback(bool bEnable);
//#endregion
//#region Constructor
//public Ethernet()
//{
//}
//#endregion
//#region Property
//public int EthernetPort
//{
// get { return this.m_EthernetPort; }
// set { this.m_EthernetPort = value; }
//}
//public string EthernetAddress
//{
// get { return this.m_EthernetAddress; }
// set { this.m_EthernetAddress = value; }
//}
//#endregion
//#region Method
//public void Connect()
//{
// if (this.IsStop == false)
// return; // Online 경우
// if (string.Compare(this.EthernetAddress, "0.0.0.0") == 0)
// {
// this.TextStatusOut("<Addr Err");
// return;
// }
// try
// {
// Thread cpClientThread = new Thread(new ThreadStart(ClientReceiveThread));
// cpClientThread.IsBackground = true;
// cpClientThread.Start();
// }
// catch
// {
// TextStatusOut(">Thread Error");
// }
//}
//private void ClientReceiveThread()
//{
// int nConnectPort = Convert.ToInt32(this.pMainForm.TcpPort);
// try
// {
// this.DelegateTextStatusOut(">Now Connecting..");
// this.cpTcpClient = new TcpClient(this.pMainForm.TcpAddress, nConnectPort);
// this.cpNetStream = cpTcpClient.GetStream();
// this.cpStmReader = new StreamReader(cpNetStream);
// this.cpStmWriter = new StreamWriter(cpNetStream);
// this.DelegateUIControl(true);
// this.DelegateTextStatusOut(">Connected Server");
// this.bIsStop = false;
// // #1 판정 데이터 전송
// if (this.pMainForm.IsTcpTransferData1 == true)
// {
// this.pMainForm.IsTcpTransferData1 = false;
// this.DelegateTransferData(this.pMainForm.TcpTransferData1);
// }
// // #2 판정 데이터 전송
// if (this.pMainForm.IsTcpTransferData2 == true)
// {
// this.pMainForm.IsTcpTransferData2 = false;
// this.DelegateTransferData(this.pMainForm.TcpTransferData2);
// }
// while (this.bIsStop == false)
// {
// string strRecvMsg = this.cpStmReader.ReadLine();
// if (null == strRecvMsg)
// {
// this.DelegateTextStatusOut(">Server Out");
// this.bIsStop = true;
// break;
// }
// this.DelegateTextStatusOut(strRecvMsg);
// }
// }
// catch
// {
// this.DelegateTextStatusOut(">Connect Fail !");
// }
// finally
// {
// this.bIsStop = true;
// this.DelegateUIControl(false);
// this.DelegateTextStatusOut(">Disconnected Server");
// if (null != this.cpStmReader)
// this.cpStmReader.Close();
// if (null != this.cpStmWriter)
// this.cpStmWriter.Close();
// if (null != this.cpNetStream)
// this.cpNetStream.Close();
// if (null != this.cpTcpClient)
// this.cpTcpClient.Close();
// }
// return;
//}
//private void TextStatusOut(string strMsg)
//{
// //this.labelTcpStatus.Text = strMsg;
//}
//private void DelegateTextStatusOut(string strMsg)
//{
// this.Invoke(new TextStatusCallback(this.TextStatusOut), strMsg);
//}
//private void DelegateText(SmartLabel label, string value)
//{
// if(label.InvokeRequired == true)
// label.Invoke(new Di
//}
//#endregion
}
}