static void TestSend() { var ip = NetHelper.ParseAddress(Host); ISocketSession session = NetService.CreateSession(new NetUri(string.Format("Tcp://{0}:{1}", ip, Port))); try { session.Send(data); Interlocked.Add(ref SendBytes, data.Length); Interlocked.Increment(ref SendCounts); //WriteLine(string.Format("{0} 发送{1}字节,共{2}字节", DateTime.Now, data.Length, SendBytes)); var receive = session.Receive(); if (receive != null) { Interlocked.Add(ref ReceiveBytes, receive.Length); Interlocked.Increment(ref ReceiveCounts); } //WriteLine(string.Format("共接收{0}字节", ReceiveBytes)); } catch (Exception ex) { WriteLine(ex.ToString()); } session.Dispose(); }