Esempio n. 1
0
 /// <summary>
 /// 发送字符串数据(如果选择DataStream模式,请选择ReadDataStream方法,client=null是广播发送)
 /// </summary>
 /// <param name="dataBuf"></param>
 /// <param name="client"></param>
 public void SendString(string dataBuf, TcpClient client = null)
 {
     if (isStart && dataBuf.Length != 0)
     {
         if (_dataType == ChannelDataType.String)
         {
             if (client != null)
             {
                 _server.Send(client, dataBuf);
             }
             else
             {
                 _server.SendAll(dataBuf);
             }
         }
         else
         {
             throw new Exception("Please Use SendDataStream() method for channel type of DataStream");
         }
     }
 }