Exemplo n.º 1
0
        public void IntroduceConnections(string senderId, IPEndPoint senderPoint, string requestId, IPEndPoint requestPoint)
        {
            using (var context = ServerModel.Get())
            {
                var content = new ClientWaitPeerConnectionCommand.MessageContent
                {
                    RequestPoint = requestPoint,
                    SenderPoint  = senderPoint,
                    RemoteInfo   = context.Users[senderId],
                };

                ServerModel.Server.SendMessage(requestId, ClientWaitPeerConnectionCommand.CommandId, content);
            }
        }
        public void Perform()
        {
            using (var server = ServerModel.Get())
            {
                var senderUser = server.Chat.GetUser(_senderId);
                var content    = new ClientWaitPeerConnectionCommand.MessageContent
                {
                    RequestIpAddress = _requestPoint.Address.GetAddressBytes(),
                    RequestPort      = _requestPoint.Port,
                    SenderIpAddress  = _senderPoint.Address.GetAddressBytes(),
                    SenderPort       = _senderPoint.Port,
                    RemoteInfo       = new UserDto(senderUser),
                };

                ServerModel.Server.SendMessage(_requestId, ClientWaitPeerConnectionCommand.CommandId, content);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Напрямую соединяет пользователей.
        /// </summary>
        /// <param name="container"></param>
        public void IntroduceConnections(string senderId, IPEndPoint senderPoint, string requestId, IPEndPoint requestPoint)
        {
            using (var context = ServerModel.Get())
              {
            var content = new ClientWaitPeerConnectionCommand.MessageContent
            {
              RequestPoint = requestPoint,
              SenderPoint = senderPoint,
              RemoteInfo = context.Users[senderId],
            };

            ServerModel.Server.SendMessage(requestId, ClientWaitPeerConnectionCommand.Id, content);
              }
        }