Socket error Windows getInputStream  
Author Message
vicky7909





PostPosted: 2008-3-19 5:47:00 Top

java-programmer, Socket error Windows getInputStream 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)
 
EJP





PostPosted: 2008-3-19 7:32:00 Top

java-programmer >> Socket error Windows getInputStream email***@***.com wrote:
> java.io.EOFException

That means the other end has already closed the connection, or possibly
an intermediate router has timed out.
 
vicky7909





PostPosted: 2008-3-20 0:22:00 Top

java-programmer >> Socket error Windows getInputStream On Mar 18, 6:31 pm, EJP <email***@***.com> wrote:
> email***@***.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





PostPosted: 2008-3-20 2:48:00 Top

java-programmer >> Socket error Windows getInputStream On Mar 19, 11:21 am, email***@***.com wrote:
> On Mar 18, 6:31 pm, EJP <email***@***.com> wrote:
>
> > email***@***.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


It worked after rebooting Windows a couple of times. I made no code
change.
 
 
vicky7909





PostPosted: 2008-3-20 10:22:00 Top

java-programmer >> Socket error Windows getInputStream On Mar 19, 5:11 pm, Knute Johnson <email***@***.com>
wrote:
> email***@***.com wrote:
> > On Mar 19, 11:21 am, email***@***.com wrote:
> >> On Mar 18, 6:31 pm, EJP <email***@***.com> wrote:
>
> >>> email***@***.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
>
> > It worked after rebooting Windows a couple of times. I made no code
> > change.
>
> Ah Windows. Always something new.
>
> --
>
> Knute Johnson
> email s/nospam/linux/
>
> --
> 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.
 
 
Roedy Green





PostPosted: 2008-3-20 16:33:00 Top

java-programmer >> Socket error Windows getInputStream On Tue, 18 Mar 2008 14:47:15 -0700 (PDT), email***@***.com
wrote, quoted or indirectly quoted someone who said :

>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
--

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





PostPosted: 2008-3-20 18:08:00 Top

java-programmer >> Socket error Windows getInputStream Roedy Green wrote:
> 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.