从C#中的其他位置从应用程序注销 [英] sign out from application from another location in c#

查看:81
本文介绍了从C#中的其他位置从应用程序注销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,

我正在开发一个聊天应用程序.这是一个基于窗口的应用程序.首先,我登录应用程序.
现在,我要在其他位置登录,并在登录应用程序后同时从以前的位置退出.

请帮助我.

Hi friends,

I''m developing a chat application. It''s a window based application. First I sign in application.
Now I want to sign in at another location and at the same time sign out from previous location after I sign in in the application.

Please help me.

推荐答案

这不是P2P,这种问题不适用,对吧?

我没看到问题.您的应用程序将所有注册的用户保留在一个词典中(如果您完全注册了),而所有当前已签名的用户保留在另一本词典中.然后,一个新用户提交用户名,您将检测使用的用户名是否已经是当前用户名(出现在当前已签名用户的词典中).如果已经签名,则必须进行不同的连接.然后(可选)断开较旧的用户,并使用同一用户的新连接.

请注意,用户身份与会话无关(如果您基于TCP工作).从技术上讲,从两个不同的计算机/IP/套接字连接的同一用户是两个不同的实体. (可选)您可以通过两个不同的远程套接字(从个人身份的角度)继续使用同一用户的两个化身.这就是为什么我在上面说可选"的原因.
—SA
This is not P2P, where such issue should not apply, right?

I don''t see a problem. You application keeps all registered users in one dictionary (if you have registration at all), all currently signed users in another one. Then a new user submit user name, you detect if the same used is already current (present in dictionary of currently signed users). If it is already signed, you have to different connections. Then you (optionally) break the older one and work with the new connection of the same users.

Note, that user identity has nothing to do with the sessions (if you work TCP-based). Technically, the same user connected from two different computers/IPs/sockets are two different entities. Optionally, you can keep working with two incarnations of the same user (from the standpoint of personal identity) through two different remote sockets. That''s why I said "optionally" above.

—SA


这篇关于从C#中的其他位置从应用程序注销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆