检测并连接在线用户 [英] Detect and connect online users

查看:69
本文介绍了检测并连接在线用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在ASP.NET Web Forms中开发一个网站。在这个网站上我想连接任意两个在线用户指定的时间(假设30秒)。



我想将用户添加到临时表中(保持跟踪在线用户)并在登录后立即为他们分配一个随机数,并在退出时从临时表中删除它们。



问题:



1.我不知道如何在会话过期或浏览器关闭时从表中删除用户。



2.我不确定如何随机连接两个在线用户(如在omegle中)。当用户A 用户C 连接时用户B 不应该能够连接到用户A和用户C

I want to develop a website in ASP.NET Web Forms. In this website i want to connect any two online users randomly for a specified time (suppose 30 seconds).

I am thinking to add the users into a temp table(to keep a track of online users) and assign them a random number as soon as they log in and delete them from the temp table on log out.

Problems:

1.I have no idea how to remove the user from the table on session expire or on browser close.

2.I am not sure how to connect two online users randomly (like in omegle). When User A and User C are connected User B should not be able to connect to "User A and User C"

推荐答案

1 - 你不能。你可以做的最多,是使用基于时间戳的超时



2 - 只是标记每个用户已经连接到某人并且不要将它们连接到其他人。 DB中的位字段。
1 - you can''t. the most you can do, is use a timeout based on a time stamp

2 - just mark each user as already connected to someone and don''t connect them to someone else. A bit field in the DB.


这篇关于检测并连接在线用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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