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 / March 2008

Tip: Looking for answers? Try searching our database.

Socket error Windows getInputStream

Thread view: 
vicky7909@rediffmail.com - 18 Mar 2008 22:47 GMT
Hello,

Java version is 1.5.0_09. I am trying to connect from a Windows
machine to another Windows machine using sockets . Getting a socket
error for the following line. and throws EOFException

Socket s = null;
ObjectInputStream sin = null;
ObjectOutputStream sout = null;

s = new Socket( host, port );
sout = new ObjectOutputStream( s.getOutputStream() );

//write data to socket
sout.writeObject( req );
sout.flush();

InputStream is =  s.getInputStream() );
sin = new ObjectInputStream( is );   // This line gives error

If I step into ObjectInputStream, I see:

public ObjectInputStream(InputStream in) throws IOException {
    verifySubclass();
    bin = new BlockDataInputStream(in);
    handles = new HandleTable(10);
    vlist = new ValidationList();
    enableOverride = false;
    readStreamHeader(); // This line gives error
    bin.setBlockDataMode(true);
}

However, the same code works when I try to connect from Linux(Red Hat
Enterprise Linux WS release 4 (Nahant Update 5)) to Windows. Turned
off Windows firewall but no luck.

On the Windows Server I am trying to connect to a server agent waiting
on port 2002 that helps me connect to Citrix running on that machine.
The agent runs as a Windows service.

What could be wrong here?

Stack Trace

java.io.EOFException
    at java.io.ObjectInputStream
$PeekInputStream.readFully(ObjectInputStream.java:2228)
    at java.io.ObjectInputStream
$BlockDataInputStream.readShort(ObjectInputStream.java:2694)
    at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:
761)
    at java.io.ObjectInputStream.<init>(ObjectInputStream.java:277)
...
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
202)
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
173)
    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
213)
    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
178)
    at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
126)
    at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
105)
    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
107)
    at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
148)
    at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
869)
    at org.apache.coyote.http11.Http11BaseProtocol
$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:
664)
    at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:
527)
    at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:
80)
    at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:595)
Knute Johnson - 18 Mar 2008 23:25 GMT
> Hello,
>
[quoted text clipped - 88 lines]
> $ControlRunnable.run(ThreadPool.java:684)
>     at java.lang.Thread.run(Thread.java:595)

I'm not sure what your problem is.  I've done this quite a few times
between Windows machines with no problem.  If the communications is
two-way it is usually necessary to create the ObjectOutputStream before
the ObjectInputStream.  That can cause some problems but it is usually
hangs and not EOFExceptions.

Probably the simplest thing you can do here is write a couple of test
programs and see if you can see where the problem is actually happening.
  Sometimes removing all the other code gets you to the problem in the
original code.

Signature

Knute Johnson
email s/nospam/linux/

     ------->>>>>>http://www.NewsDem

EJP - 19 Mar 2008 00:31 GMT
> java.io.EOFException

That means the other end has already closed the connection, or possibly
an intermediate router has timed out.
vicky7909@rediffmail.com - 19 Mar 2008 17:21 GMT
> vicky7...@rediffmail.com wrote:
> > java.io.EOFException
>
> That means the other end has already closed the connection, or possibly
> an intermediate router has timed out.

So how do I get around this? I was able to connect until day before
and suddenly I started getting this error.

Thanks for posting your answer in both forums
vicky7909@rediffmail.com - 19 Mar 2008 19:47 GMT
On Mar 19, 11:21 am, vicky7...@rediffmail.com wrote:

> > vicky7...@rediffmail.com wrote:
> > > java.io.EOFException
[quoted text clipped - 6 lines]
>
> Thanks for posting your answer in both forums

It worked after rebooting Windows a couple of times. I made no code
change.
Knute Johnson - 19 Mar 2008 23:11 GMT
> On Mar 19, 11:21 am, vicky7...@rediffmail.com wrote:
>>
[quoted text clipped - 9 lines]
> It worked after rebooting Windows a couple of times. I made no code
> change.

Ah Windows.  Always something new.

Signature

Knute Johnson
email s/nospam/linux/

     ------->>>>>>http://www.NewsDem

vicky7909@rediffmail.com - 20 Mar 2008 03:21 GMT
On Mar 19, 5:11 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
wrote:
> vicky7...@rediffmail.com wrote:
> > On Mar 19, 11:21 am, vicky7...@rediffmail.com wrote:
[quoted text clipped - 21 lines]
> Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
>       ------->>>>>>http://www.NewsDem

I'm probably going to set-up an alternate dev. environment on Linux -
just in case.  I lost half a day.
Knute Johnson - 20 Mar 2008 04:48 GMT
> On Mar 19, 5:11 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
> wrote:
[quoted text clipped - 22 lines]
> I'm probably going to set-up an alternate dev. environment on Linux -
> just in case.  I lost half a day.

They both have problems and they are different.  There are a lot of
posts here "My xyz works on Linux but not on XP" or vice versa.

I'm fighting one now where a server program running on a Windows machine
gets stopped by random blow ups of svchost.exe.  It will run for weeks
without a problem and then stop two or three times in one day.  It's
enough to drive you nuts.

Signature

Knute Johnson
email s/nospam/linux/

Roedy Green - 20 Mar 2008 09:32 GMT
>java.io.EOFException

the other end closed the stream right away.

You might want to use a protocol sniffer to see what the other end is
up to.

see http://mindprod.com/jgloss/sniffer.html
Signature


Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

EJP - 20 Mar 2008 11:08 GMT
> You might want to use a protocol sniffer to see what the other end is
> up to.

The other end, or somebody, send a FIN. No sniffing required really.


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.