0 Replies Latest reply on May 1, 2010 7:54 PM by SOMEONEINTHEWORLD

    displaying data

    SOMEONEINTHEWORLD Level 1

      Hello,

       

      Hello,

       

      I have a socket server which will keep on sending data to the clients.  In the data there are data which would not change that offen, these data i want it to send only once in the begining i.e when the client connects.  These unchanging should be captured in the client side and displayed along with the changing data.

       

      below is the code,

       

      server side,
      public void run() {
          try {
            PrintStream pstream = new PrintStream(csocket.getOutputStream());
            str firstdata = "Board Name1&Board Date";   
                 while(true) {
                    try{
              str repdata = random(100) +"&"+random(200);
                     pstream.println(firstdata + repdata + "\u0000");
            Thread.sleep(1000);
            } catch (InterruptedException e) {
              e.printStackTrace();
        }  

       

      }        

       

      client side,

       

      XMLSocket.prototype.onData = function(msg) {
          arr = msg.split("&");
          boardname.htmlText = arr[0];  //This data should stay on till the client disconnects

          boarddate.htmlText = arr[1];   //This data should stay on till the client disconnects

       

         repdata1.htmlText= arr[2];  //contineously changing data

         repdata2.htmlText=arr[3];  //contineously changing data
      };

       

      As the msg arrives, the boardname and boarddate are getting replaced. 

       

      Can someone tell me how to accomplish the above task.

       

      Server side is in Java.

       

      Thanks