Beispiel #1
0
        public void HelloMessage()
        {
            StreamWriter writer = new StreamWriter(stream);
            HelloMessage msg    = new HelloMessage {
                Name = Name
            };

            writer.Write(msg.ToFullString());
            writer.WriteLine();
            writer.Flush();
        }
        public void AddConnection(MyTCPChatUser user, HelloMessage message)
        {
            user.Name = message.Name;
            user.ID   = Guid.NewGuid().ToString();
            //добавляем в список
            usersList.Add(user);
            //отсылаем ID
            message.ID = user.ID;
            StreamWriter writer = new StreamWriter(user.stream);

            writer.Write(message.ToFullString());
            writer.WriteLine();
            writer.Flush();
        }