Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: java.io.EOFException when sending object through socket

  1. #1
    Junior Member
    Join Date
    Aug 2011
    Posts
    13
    My Mood
    Cool
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default java.io.EOFException when sending object through socket

    Hi all,

    I've been struggeling with this issue for some time now and I just don't know why it fails.
    I have created a small program that send an object through a socket to a server where the server receives the object and prints a attribute
    value of the object.

    I tested this in a little program and that works fine but this was only meant for one connection and than everthing closes.

    The architecture is that of a server->agent where the server send a object to the agent. The agent has to run as long as it is need to and
    the server will open a socket to the server.

    When I start the agent and than the server it will give a "java.io.EOFException". The full errror can be seen below:
    java.io.EOFException
    	at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
    	at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
    	at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
    	at java.io.ObjectInputStream.<init>(Unknown Source)
    	at Agent.runAgent(Agent.java:98)
    	at Agent.<init>(Agent.java:50)
    	at Agent.main(Agent.java:170)
    java.io.EOFException
    	at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
    	at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
    	at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
    	at java.io.ObjectInputStream.<init>(Unknown Source)
    	at Agent.runAgent(Agent.java:98)
    	at Agent.<init>(Agent.java:50)
    	at Agent.main(Agent.java:170)

    Can anybody tell me why my this is happening because I'm all out of ideas at the moment.
    I've included the two Eclipse projects in ZIP format.

    JaneAgent_20111103.zip
    JaneServer_20111103.zip

    The Agent is started by running the Agent class. The server is started by running the JaneServer class.
    The software uses a Apache Derby database which I can't include but maybe someone can help me.

    Thank you in advance.


  2. #2
    Junior Member
    Join Date
    Aug 2011
    Posts
    13
    My Mood
    Cool
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: java.io.EOFException when sending object through socket

    Can anybody help me with this. I'm reallt stuck here and I don't know what I'm doing wrong.

    Thanax in advance

  3. #3
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 287 Times in 225 Posts
    Blog Entries
    4

    Default Re: java.io.EOFException when sending object through socket

    Please provide an SSCCE - Short, Self Contained, Correct Example
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

Similar Threads

  1. Sending integers through a socket
    By Fricken Hamster in forum What's Wrong With My Code?
    Replies: 3
    Last Post: August 20th, 2011, 05:44 PM
  2. Sending zip from server socket
    By moon_werewolf in forum Java Theory & Questions
    Replies: 0
    Last Post: May 30th, 2011, 07:51 AM
  3. [SOLVED] Sending xml file over a socket
    By Kakashi in forum Java Networking
    Replies: 2
    Last Post: March 9th, 2011, 08:41 AM
  4. Replies: 2
    Last Post: February 14th, 2011, 04:36 PM
  5. Sending object through socket
    By Alexandrinne in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 16th, 2010, 01:18 AM