Ejemplo n.º 1
0
 private void Window1_Loaded(object sender, RoutedEventArgs e)
 {
     // Create new instance of classes and delegates
     UpdateInfoTxt           = new UpdateInfoTxtDelegate(UpdateInfoTxtMethod); // need to define the delegate before the class, it gets passed to the class
     server                  = new TcpServer(UpdateInfoTxt, Window1);
     client                  = new MyTCPClient(UpdateInfoTxt);
     listener                = new UdpListener(UpdateInfoTxt);
     server.servIP           = Dns.GetHostAddresses(Dns.GetHostName())[0];
     client.ip               = Dns.GetHostAddresses(Dns.GetHostName())[0];
     this.ServIP_txt.Text    = server.servIP.ToString();
     server.servPort         = Convert.ToInt32(this.servPort_txt.Text);
     client.port             = Convert.ToInt32(this.servPort_txt.Text);
     this.statusBox_txt.Text = "";
     this.filePath_txt.Text  = Directory.GetCurrentDirectory() + @"\vgsslogs\" + DateTime.Now.ToString("yyyy-MM-dd_hh-mm-ss-tt") + ".txt";
 }
Ejemplo n.º 2
0
 public UdpListener(UpdateInfoTxtDelegate d)
 {
     UpdateInfoTxt = d;
 }
Ejemplo n.º 3
0
 // Constructor
 public MyTCPClient(UpdateInfoTxtDelegate d)
 {
     UpdateInfoTxt = d;
 }
Ejemplo n.º 4
0
        private TcpClient client; // this is the client that connected to our server

        // Constructor
        public TcpServer(UpdateInfoTxtDelegate d, Window w)
        {
            UpdateInfoTxt = d;
            win           = w;
        }