public void RunAsyn() { client = new CtkNonStopTcpClient("127.0.0.1", 10002); client.EhFirstConnect += (ss, ee) => { CtkLog.InfoNs(this, "evtFirstConnect"); }; client.EhFailConnect += (ss, ee) => { CtkLog.InfoNs(this, "evtFailConnect"); }; client.EhErrorReceive += (ss, ee) => { CtkLog.InfoNs(this, "evtErrorReceive"); }; client.EhDataReceive += (ss, ee) => { CtkLog.InfoNs(this, "evtDataReceive"); }; client.NonStopConnectAsyn(); }
public void RunAsyn() { client = new CtkNonStopTcpClient("127.0.0.1", 5003); client.EhFirstConnect += (ss, ee) => { Write("evtFirstConnect"); }; client.EhFailConnect += (ss, ee) => { var sb = new StringBuilder(); sb.Append("evtFailConnect: "); sb.Append(ee.Exception.StackTrace); Write(sb.ToString()); }; client.EhErrorReceive += (ss, ee) => { Write("evtErrorReceive"); }; client.EhDataReceive += (ss, ee) => { var ea = ee as CtkNonStopTcpStateEventArgs; var ctkBuffer = ea.TrxMessageBuffer; this.Write(ctkBuffer.GetString()); }; client.NonStopConnectAsyn(); }