protected PeerBase(Guid guid, TcpClient tcpClient, Server server) { this.guid = guid; this.tcpClient = tcpClient; this.server = server; Task.Run(()=>PeerMain()); }
public ExecutionServer(int port) { this.port = port; hostname = Dns.GetHostName(); //foreach (IPAddress ip in Dns.GetHostEntry(hostname).AddressList) //{ // Console.WriteLine(ip); //} //Console.WriteLine("Input the IP:"); //serverIP = IPAddress.Parse(Console.ReadLine()); serverIP = Dns.GetHostEntry(hostname).AddressList.First(x=>x.AddressFamily == AddressFamily.InterNetwork); server = new Server(); server.logger.Info(serverIP.ToString()); isTerminated = false; serverListener = new TcpListener(serverIP, port); peerDictionary = new Dictionary<Guid, PeerBase>(); AcceptConnection(); }
public Peer(Guid guid, TcpClient tcpClient, Server server) : base(guid, tcpClient, server) { }