示例#1
0
        public static void Main(string[] args)
        {
            Console.WriteLine ("Hello World!");

            Datagram d = new Datagram ();
            d.Timestamp = DateTime.UtcNow;
            d.Message = "Echo echo!";
            d.Metadata = "HW!";

            try {

                using(DatagramServiceClient client = new DatagramServiceClient("DatagramClientUdpEndpoint")){

                    client.ProcessDatagram(d);
                }

            } catch (Exception ex) {
                Debugger.Log (0, Debugger.DefaultCategory, ex.Message + '\n' + ex.StackTrace.ToString ());
            }
        }
示例#2
0
    public void Send()
    {
        var text = this.chatField.Text + '\n';
        this.chatField.Text = "";

        this.chatLog.Buffer.InsertAtCursor (text);

        Datagram d = new Datagram ();
        d.Timestamp = DateTime.UtcNow;
        d.Message = text;
        d.Metadata = "HW!";

        try {

            using(DatagramServiceClient client = new DatagramServiceClient("DatagramClientUdpEndpoint")){

                client.ProcessDatagram(d);
            }

        } catch (Exception ex) {
            Debugger.Log (0, Debugger.DefaultCategory, ex.Message + '\n' + ex.StackTrace.ToString ());
        }
    }
示例#3
0
 public void ProcessDatagram(Datagram datagram)
 {
     var text = "Process Datagram: " + datagram.ToString ();
     Debugger.Log(3,Debugger.DefaultCategory,text);
     Console.WriteLine (text);
 }