x11 Posted December 4, 2021 Share Posted December 4, 2021 Я так понял, что свойство RemoteHost заполняется только при входе, а потом, даже если IP адрес меняется на устройстве, то свойстве RemoteHost остается старый адрес. Как принудительно обновить адрес в RemoteHost? Спасибо. Quote Link to comment Share on other sites More sharing options...
Tokay Posted December 4, 2021 Share Posted December 4, 2021 Насколько я представляю TCP, если IP меняется на устройстве, то будет повторное соединение, IP должен быть актуальным всегда. Quote Link to comment Share on other sites More sharing options...
x11 Posted December 5, 2021 Author Share Posted December 5, 2021 нет, ID сессии не меняется, поэтому сервер uniGUI ни о чем не подозревает Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 5, 2021 Share Posted December 5, 2021 23 hours ago, x11 said: Я так понял, что свойство RemoteHost заполняется только при входе, а потом, даже если IP адрес меняется на устройстве, то свойстве RemoteHost остается старый адрес. Как принудительно обновить адрес в RemoteHost? Используйте UniSession.ARequest.RemoteIP 1 Quote Link to comment Share on other sites More sharing options...
x11 Posted December 5, 2021 Author Share Posted December 5, 2021 Использовать как? Читать из этого свойства? Или его самому принудительно обновить? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 5, 2021 Share Posted December 5, 2021 Читать. Quote Link to comment Share on other sites More sharing options...
x11 Posted December 5, 2021 Author Share Posted December 5, 2021 Проблема в другом. Я пытаюсь создать монитор пользователей, кто подключен и какая форма открыта. На основе вашего примера, где используется UniServerModule.SessionManager.Sessions // Here we do a fast copy of list to another array for later use. for I := 0 to Pred(S.SessionList.Count) do begin U := S.SessionList[I]; fSessionList[I].ASessionId := U.SessionId; fSessionList[I].AIP := U.RemoteIP; и вот здесь IP не меняется, не актуализируется Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 5, 2021 Share Posted December 5, 2021 2 hours ago, x11 said: U.RemoteIP; U.ARequest.RemoteIP; 1 Quote Link to comment Share on other sites More sharing options...
x11 Posted December 5, 2021 Author Share Posted December 5, 2021 Сессии себя ведут странно. Я уже на смартфоне закрыл браузер 28 минут назад, а сессии все еще живут. Как такое может быть? SessionTimeuot 15 минут. Откуда в UniServerModule.SessionManager.Sessions до сих пор живут сессии, которые были пол часа назад прекращены? Что я делаю не так? Добавлю еще, что у меня есть код для автоматического продления сессии: procedure TUniMainModule.UniGUIMainModuleSessionTimeout(ASession: TObject; var ExtendTimeOut: Integer); begin if not AllowTerminate then ExtendTimeOut := UniServerModule.SessionTimeout;// продлеваем сессию end; Но ведь я закрыл браузер на смартфоне. Почему сессия продлевается? Quote Link to comment Share on other sites More sharing options...
x11 Posted December 6, 2021 Author Share Posted December 6, 2021 20 hours ago, Sherzod said: U.ARequest.RemoteIP; на этой строке получаю исключение (ошибку) AV - Access violation fSessionList[I].AIP := U.ARequest.RemoteIP; Но ошибка только, если запустить монитор сессии еще раз параллельно с другого браузера. Т.е. когда один пользователь уже работает, то ошибки нет. Когда второй пользователь тоже хочет открыть монитор сессий, то U.ARequest возвращает nil. Quote Link to comment Share on other sites More sharing options...
x11 Posted December 6, 2021 Author Share Posted December 6, 2021 При этом строка fSessionList[I].AIP := U.RemoteIP; не вызывает ни каких исключений и ошибок Quote Link to comment Share on other sites More sharing options...
x11 Posted December 8, 2021 Author Share Posted December 8, 2021 up Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 8, 2021 Share Posted December 8, 2021 On 12/6/2021 at 5:52 PM, x11 said: Но ошибка только, если запустить монитор сессии еще раз параллельно с другого браузера. Т.е. когда один пользователь уже работает, то ошибки нет. Когда второй пользователь тоже хочет открыть монитор сессий, то U.ARequest возвращает nil. 2 hours ago, x11 said: up Пожалуйста, создайте тестовый проект. Quote Link to comment Share on other sites More sharing options...
x11 Posted December 8, 2021 Author Share Posted December 8, 2021 1 hour ago, Sherzod said: Пожалуйста, создайте тестовый проект. Возьмите свой пример (\Demos\Desktop\Session List) из Demo и замените там 72 строку ASessionList[I].AIP := U.ARequest.RemoteIP;// U.RemoteIP; и запустите в разных браузерах Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 8, 2021 Share Posted December 8, 2021 1 minute ago, x11 said: Возьмите свой пример (\Demos\Desktop\Session List) из Demo и замените там 72 строку Ok, я проверю на этом примере. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 8, 2021 Share Posted December 8, 2021 On 12/6/2021 at 5:52 PM, x11 said: на этой строке получаю исключение (ошибку) AV - Access violation fSessionList[I].AIP := U.ARequest.RemoteIP; Попробуйте такой подход: 1. fSessionList[I].AIP := U.ARequest.RemoteIP; используйте U.RemoteIP 2. procedure TUniMainModule.UniGUIMainModuleHandleRequest(ASession: TObject; var Handled: Boolean); begin with (ASession as TUniGUISession) do RemoteIP := ARequest.RemoteIP end; 1 Quote Link to comment Share on other sites More sharing options...
x11 Posted December 8, 2021 Author Share Posted December 8, 2021 Спасибо, вроде получилось. Было бы хорошо, если бы это исправили в uniGUI, чтобы не использовать данный костыль. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.