示例#1
0
 public Server(int port)
 {
     window = new MainWindow();
     window.Show();
     window.giveServer(this);
     this.serverPort = port;
     serverListener = new TcpListener(getLocalIp(), port);
     window.setConnectedText("Listening For Clients");
     listenForClients();
 }
示例#2
0
 public Server(IPAddress serverIp, int port)
 {
     window = new MainWindow();
     window.Show();
     window.giveServer(this);
     this.serverIp = serverIp;
     this.serverPort = port;
     fileConnection = new TcpClient();
     messageConnection = new TcpClient();
     window.setConnectedText("Attempting to Connect to: " + serverIp.ToString() + ":" + port);
     Thread connectToServerThread = new Thread(new ThreadStart(connectToServer));
     connectToServerThread.Start();
     connectToServerThread.IsBackground = true;
 }