예제 #1
0
 public static void SendData(MessagePacket mp)
 {
     MemoryStream stream = new MemoryStream();
     DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(MessagePacket));
     ser.WriteObject(stream, mp);
     var packet = Encoding.UTF8.GetString(stream.GetBuffer(), 0, (int)stream.Length);
     client.SendData(packet);
 }
예제 #2
0
 public static void SendDataBroadNotSelf(string data)
 {
     MessagePacket mp = new MessagePacket();
     mp.D = data;
     mp.T = (int)SendMode.SendBroadNotSelf;
     MemoryStream stream = new MemoryStream();
     DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(MessagePacket));
     ser.WriteObject(stream, mp);
     var packet = Encoding.UTF8.GetString(stream.GetBuffer(), 0, (int)stream.Length);
     client.SendData(packet);
 }