The previous paragraph I made a pull-based chat room with APS.Net, and later I would like to increase the content of the game, I feel that the lack of response based on pull technology is not good, so I want to change to pull-based technology.
I have already tried, the code is as follows:
// Content.aspx.cs ////
Public class content: system.web.ui.page
{
Private Void Page_Load (Object Sender, System.EventArgs E)
{
Session.Timeout = 60;
Response.write ("Welcome...
/ n");
Response.flush ();
Application [session.SessionId] = response;
System.threading.thread.sleep (system.threading.timeout.infinite);
}
}
// send.aspx.cs //
Public class send: system.Web.ui.page
{
protected system.web.ui.webcontrols.button buttonsend;
protected system.web.ui.webcontrols.textbox textbox1;
Private void buttonsend_click (Object Sender, System.Eventargs E)
{
FOREACH (String Name in Application.allKeys)
{
HTTPRESPONSE RESPONSE = Application [Name] as httpresponse;
IF (Response! = null && response.isclientconnected)
{
Response.write (TextBox1.text "
/ n");
Response.flush ();
}
Else
{
Application.Remove (Name);
}
}
}
}
You can chat, but find a big problem: the user is limited to 50 or so, and even more, it will cause other users to be stagnant.
Please answer questions, you can also separate it!