コード例 #1
0
ファイル: Program.cs プロジェクト: ana-lopes/PJR-Mastermind
 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();
 }
コード例 #2
0
 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();
 }