• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Getting "java.io.EOFException" after sending a file through socket

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm trying to implement basic communication through sockets, what I have now is:
- server start's to listen on socket,

- client connects, and server starts separate thread to operate with that client,
- both open Object output and input streams,

- client sends two i Doubles, String and Long over that stream (flushes after each one),

- server succesfully receives those objects over previously opened streams,


and now "the hard part",
- clients wants to send a file so opens different output stream (not object output stream) and sends the file,

- the server receives the file (also uses simple input stream instead ObjectInputStream),


- so far everything works fine, file is received, but now server performs some time consuming processing on that file after which sends response with whe results to client,

- the client is supposed to receive the result what finishes the whole communication,


Unfortunately, that last step on client side fails with exception:


I want client to block on waiting for server response after sending the file, but it suddenly finishes with the exception after sending the file. I am pretty sure that I do something wrong with switching between simple streams and Object streams.

Does anybody know what should I change to haave it working?

Thank you in advance!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic