Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2007

Tip: Looking for answers? Try searching our database.

problems with readObject and EOF Exception

Thread view: 
_kOws - 20 Aug 2007 15:46 GMT
Hi,
I'm a Java-beginner and I'm writing a small client/server software and
I'm in troubles looping on
readObject:
-- I have a client that connects to the server and read an object (an
HashMap)
from the server; after that it have to loop on the readObject waiting
for another
HashMap that the server will (or will not) send.
-- The server when the client connect, sends the HashMap, and in case
other clients connect
it will update the HashMap and re-send it to the clients.

I need that the client, after it receive the first object, waits for
another incoming object:
but after reading the first object, readObject throws an EOF
Exception.
How can I handle thi Exception to continue looping on the
readObject(), waiting for a possible
update from the server?

Sorry for my english, and thanks to anyone who will help me coming out
this situation!

Regards
G.

(an extract of code follows)

[CLIENT]
....
try{
 while(true){
                fileHashMap = is_obj.readObject();
                .......
               // Working on the HashMap
               .......
               }
   } catch (ClassNotFoundException e) {
               e.printStackTrace();
      } catch (IOException e) {
                 e.printStackTrace();
      }
[SERVER]
.....
//I'm in a function that I call every time that the map is updated

c.os_obj.writeObject(Mappa);
c.os_obj.flush();
c.os_obj.reset();
//END
_kOws - 20 Aug 2007 15:53 GMT
> Hi,
> I'm a Java-beginner and I'm writing a small client/server software and
> I'm in troubles looping on
> readObject:
[cut]

I'm really sorry for this long message...
the problem was that the server closed the socket too early, and that
generated
the EOF Exception on the client.

Sorry again!

G.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.