private void button1_Click(object sender, EventArgs e) { var msg = new MessageCommand <TextMessage> { Content = new TextMessage { Content = "ce shi shu ju " }, }; _server.GetSocket().SendTo(msg.Serialize(), new IPEndPoint(IPAddress.Parse(tbip.Text.Trim()), int.Parse(textBox2.Text.Trim()))); }
public void Send <T>(MessageCommand <T> messageCommand) where T : IMessage { _socket.SendTo(messageCommand.Serialize(), messageCommand.Target); }