static void Main(string[] args) { Console.WriteLine("Sou o Servidor!!!!\nQue port queres usar?"); int port; while (!Int32.TryParse(Console.ReadLine(), out port)) { Console.WriteLine("Não dá.. :/"); }; Console.WriteLine("ok ;)"); ChatServer server = new ChatServer(port); server.Run(); }
public ChatClient(TcpClient client, ChatServer server) { messageQueue = new Queue<string>(); this.server = server; this.client = client; this.stream = client.GetStream(); // Inicialmente o nosso nick é o nosso IP e porta this.nick = client.Client.RemoteEndPoint.ToString(); dead = false; Thread thread = new Thread(SendMessage); thread.Start(); }