static void Main(string[] args) { MessageMaker mm = new MessageMaker(); Message msg = mm.makeMessage("fromFoo", "toBar"); Utilities.showMessage(msg); Console.Write("\n\n"); }
//----< send a demonstraton message >-------------------------------- private void send_Click(object sender, RoutedEventArgs e) { try { #region ///////////////////////////////////////////////////// // This commented code was put here to allow // user to change local port and address after // the channel was started. // It does what is intended, but would throw // if the new port is assigned a slot that // is in use or has been used since the // TCP tables were last updated. // if (!localPort.Equals(lPort.Text)) // { // localAddress = rcvr.address = lAddr.Text; // localPort = rcvr.port = lPort.Text; // rcvr.shutDown(); // setupChannel(); // } #endregion if (!remoteAddress.Equals(rAddr.Text) || !remotePort.Equals(rPort.Text)) { remoteAddress = rAddr.Text; remotePort = rPort.Text; } // - Make a demo message to send // - You will need to change MessageMaker.makeMessage // to make messages appropriate for your application design // - You might include a message maker tab on the UI // to do this. MessageMaker maker = new MessageMaker(); Message msg = maker.makeMessage( Utilities.makeUrl(lAddr.Text, lPort.Text), Utilities.makeUrl(rAddr.Text, rPort.Text) ); // lStat.Text = "sending to" + msg.toUrl; sndr.localUrl = msg.fromUrl; sndr.remoteUrl = msg.toUrl; //lStat.Text = "attempting to connect"; // if (sndr.sendMessage(msg)) //lStat.Text = "connected"; //else //lStat.Text = "connect failed"; postSndMsg(msg.content); } catch(Exception ) { //lStat.Text = ex.Message; } }