|
@@ -1,9 +1,6 @@
|
|
|
using SuperSocket.ClientEngine;
|
|
|
-using SuperSocket.ProtoBase;
|
|
|
using System;
|
|
|
-using System.Linq;
|
|
|
using System.Net;
|
|
|
-using ET;
|
|
|
|
|
|
namespace ET.Server
|
|
|
{
|
|
@@ -16,20 +13,19 @@ namespace ET.Server
|
|
|
{
|
|
|
FastStreamComponent.Instance = self;
|
|
|
|
|
|
- EasyClient client = new EasyClient();
|
|
|
- self.FastStreamClient = client;
|
|
|
- client.Initialize<FastStreamBuffer>(new FastStreamMessageDecoder(FastStreamMessageDecoder.LEN_HEAD), OnSessionDataReceived);
|
|
|
- client.NoDelay = true;
|
|
|
- client.ReceiveBufferSize = 10* 1024 * 1024;
|
|
|
+ self.FastStreamClient = new EasyClient();
|
|
|
+ self.FastStreamClient.Initialize<FastStreamBuffer>(new FastStreamMessageDecoder(FastStreamMessageDecoder.LEN_HEAD), OnSessionDataReceived);
|
|
|
+ self.FastStreamClient.NoDelay = true;
|
|
|
+ self.FastStreamClient.ReceiveBufferSize = 10* 1024 * 1024;
|
|
|
|
|
|
- client.Connected += new EventHandler(OnSessionConnected);
|
|
|
- client.Error += new EventHandler<ErrorEventArgs>(OnSessionError);
|
|
|
- client.Closed += new EventHandler(OnSessionClosed);
|
|
|
+ self.FastStreamClient.Connected += new EventHandler(OnSessionConnected);
|
|
|
+ self.FastStreamClient.Error += new EventHandler<ErrorEventArgs>(OnSessionError);
|
|
|
+ self.FastStreamClient.Closed += new EventHandler(OnSessionClosed);
|
|
|
|
|
|
//IPAddress ipAddress = Dns.GetHostAddresses("localhost")[0];
|
|
|
IPAddress ip = IPAddress.Parse("127.0.0.1");
|
|
|
IPEndPoint endpoint = new IPEndPoint(ip, 3370);
|
|
|
- client.ConnectAsync(endpoint);
|
|
|
+ self.FastStreamClient.ConnectAsync(endpoint);
|
|
|
}
|
|
|
}
|
|
|
|