Exemple #1
0
 /// <summary>
 /// 定义服务端的ip地址和端口,以及接收数据的头和尾,只有在头和尾之间的数据才算有效数据
 /// </summary>
 /// <param name="ip">ip地址</param>
 /// <param name="port">服务端口</param>
 /// <param name="startFilter">数据头</param>
 /// <param name="endFilter">数据尾</param>
 public SocketClient(string ip, int port, string startFilter, string endFilter)
 {
     this.ip   = ip;
     this.port = port;
     if (!string.IsNullOrEmpty(startFilter))
     {
         this.startFilter = startFilter;
     }
     if (!string.IsNullOrEmpty(endFilter))
     {
         this.endFilter = endFilter;
     }
     client = new SuperSocket.ClientEngine.EasyClient();
     client.Initialize(new MyBeginEndMarkReceiveFilter(this.startFilter, this.endFilter), OnReceived);
 }