I'm almost sure this is one of those problems cuased by
my misconception of how things work in Java v.s. C++,
but I have run this thing around for days without resolve. 

Maybe someone can see the obvious

I'm trying to send a serialized class down a network pipe and am 
only getting the first one on the other end. The rest seem to vanish.

The concept is to have a gpsStat class serialized and sent down the
pipe each second to a client that will display it. My code appears
to be working for the most part except that the object sent from 
the server to the client never changes from the first one I sent.


On the sending end I have:


gpsStat y=new gpsStat();   //make object to serialize
while(true)
  {            //fake data into gpsStat
   y.month++;  y.day++; y.year++;
   sleep(500);   //fake pause to simulate GPS reciever

   objOStream.writeObject(y);  //send it
   objOStream.flush();          
   }      


while(true)    //keep printing out objects as they arrive
  {                
    gpsStat g=(gpsStat)objIStream.readObject(); //get object
    System.out.println("server returned -> "+g.toString()); //print
object
  }

Anybody see my mistake?

Full source and example are at  

http://ouray.cudenver.edu/~gavalent/java/problem1.html

-- 
Glenn Valenta   Engineering @ http://www.coloradostudios.com
[EMAIL PROTECTED]   http://ouray.cudenver.edu/~gavalent/
[EMAIL PROTECTED]               Personal mail
[EMAIL PROTECTED]     Work mail

Reply via email to