/// <summary> /// 初始化网络参数 /// </summary> public FrmTest() { InitializeComponent(); Control.CheckForIllegalCrossThreadCalls = false; t = new Thread(Start); n = new NetTraner("192.168.1.130", 1112, 1111); n.DataReceived += new NetTraner.DataReceivedEventHandler(n_DataReceived); n.ErrorMessage += new NetTraner.ErrorMessageEventHandler(n_ErrorMessage); n.InitSendLink += new NetTraner.InitSendLinkEventHandler(n_InitSendLink); n.InitListenLink += new NetTraner.InitListenLinkEventHandler(n_InitListenLink); n.CutSendLink += new NetTraner.CutSendLinkEventHandler(n_CutSendLink); }
public DataSend(bool isHost,string strIP,int intSendPort,int intListenPort,string strPort,HostBacker hb) { this.isHost = isHost; this.strPort = strPort; this.hb = hb; n = new NetTraner(strIP, intSendPort, intListenPort); str_IPAddress = strIP; //错误事件 interHostBack.ErrorMessage += _ErrorMessage; n.ErrorMessage += _ErrorMessage; n.DataReceived += n_DataReceived; n.InitListenLink += n_InitListenLink; n.CutSendLink += n_CutSendLink; angenCount = 0; //angenTime.Interval = 1000; //angenTime.Elapsed += new System.Timers.ElapsedEventHandler(angenTime_Elapsed); //angenTime.Stop(); }