I'm trying to imlpement a chat server in which the communication is done through an open socket connection. My server is on a shared hosting setup, and I can't recieve TCP listen requests. (Obviously, but I had to try)
After I tested it anyways (sockets in asp.net), I decided that's I'd try an use port 80 and a custom webpage as a open socket connection (actually an httphandler). Amazingly enough it works perfectlty, but no matter how I try to disable the buffering, there's always a 40-500 byte buffer that doesn't get sent until there is more data in the buffer. In direct sockets, this not the case.
What I've done, in a page test - not a handler test.
<%
@ Page Language="C#" Buffer=false %>
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Buffer = false;
HttpContext.Current.Response.BufferOutput = false;
and then after every: Response.Output.Write(mys + "\r\n\r\n");I call:
Response.Output.Flush();
Response.OutputStream.Flush();
System.Threading.
Thread.Sleep(50);
Are there any other techniques to getting ASP.net to stop buffering and just send the page data immediately? Also, the page doesn't close the connection at all, it just leaves it open as long as it can (receiving data), and it transmits by http POST to another page elsewhere in the app. My client for reading the page is PUTTY or telnet on port 80, so I can see how "fast" the data comes in this testing stage.
In the odd case you know of a technique to implement a chat server type app WITHOUT polling, I'd be interested in that as it would solve my problem too.