c# - How to receive data to HTML page from TCP/IP server using socket connection and Server-Sent Events in real-time? -


I am trying to use the data sent from the server to the TCP / IP server in real time and from the server .

Here are some code:

  Public Zero Process Requests (HTTP Reference Reference) {HTPRSpps Response = Reference. response; Start date time = date time.Now; Response.ContentType = "text / event-stream"; Try {ClientSocket = New Socket (Address Family.InterNetwork, SocketType.Stream, ProtocolType.Tcp); Ipaid IPADress = IP Address Percy ("127.0.0.1"); // Server Port 1000 listening on IPEndPoint ipEndPoint = new IPPpoint (IPADress, 1000); // Connect to the server clientSocket .bink connect (ipdpoint, new asynchroncate (onconnect), blank); } Hold (Exception precedent) {// MessageBox.Show (ex.Message, "SGSclient", MessageBoxButtons.OK, MessageBoxIcon.Error); } For (int i = 0; i <50; i ++) {try.write (string. Format ("data: {0} \ n \ n", i)); System.Threading.Thread.Sleep (100); Response.Flush (); } Hold {}}}  

but the callback method is not working. Can you please explain the server-sent events and single-line, which in real time get data from TCP / IP?

Single R

Strong> doing the right thing. I got good feedback for your needs.


Comments