简体   繁体   English

如何禁止特定的套接字重新连接到我的聊天?

[英]How can I ban a specific socket from reconnecting to my chat?

I'm writing a multi-client chat with managers and simple users. 我正在与经理和简单用户进行多客户端聊天。 Whenever a manager kicks a user I don't want them to be able to just reconnect with the same username and IP address. 每当经理踢用户时,我都不希望他们能够使用相同的用户名和IP地址重新连接。 How can I achieve something like that? 我该如何实现这样的目标? I'm working in python, but I think a generic explanation of the idea might be better for more people to understand it. 我正在使用python进行工作,但是我认为对该想法进行一般性的解释可能会使更多的人理解它。

1)You can store the ip in the banned ip database and then check if the the user is banned 2) if you do not want to use database you can just create a cookie when managers kicks the user and store at client side and check whether a client is banned or not. 1)您可以将ip存储在禁止的ip数据库中,然后检查用户是否被禁止2)如果您不想使用数据库,则可以在管理员踢用户并将其存储在客户端时仅创建一个cookie,并检查是否客户是否被禁止。 But solution 1 is more reliable 但是解决方案1更可靠

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM