Re: Socket returns EOF prematurely
From: perry (perry_at_cplusplus.org)
Date: 06/16/04
- Next message: perry: "Re: Socket returns EOF prematurely"
- Previous message: perry: "Re: Is there a Flash Player or Authorware player written in Java ?"
- In reply to: Nathan Davis: "Socket returns EOF prematurely"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 16 Jun 2004 08:23:29 -0400
yes, i have seen this type of thing before. the problem is not with
linux, it has to do with a more efficient socket implementation on linux.
i strongly suspect your EOF is as a result of your connection is being
made too fast and either the client or the server is either not ready or
has given up.
to resolve this problem i had to implement a more intelligent connection
scheme where i would try 3 times, pausing 250 ms before each attempt...
it always seemed to get it either on the 1st or 2nd attempt, i never had
any problems after that.
i'll try to dig up the code and post it for you later
- perry
Nathan Davis wrote:
> Hi,
>
> I am having problems reading data from a socket. The problem only
> occurs while trying to read from one particular server, and does not
> occur on Windows (as far as I know, this may occur only on Linux).
>
> The server is free.teranews.com, and I am trying to connect to the NNTP
> port (119). To make things even more bizar, I only have trouble when I
> try to issue the LIST command. After issuing the command, Java will not
> return any more data, and will behave as if EOF was reached on the socket.
>
> The server *is* returning data. On windows (reading with Java), the
> data is returned, but there are a bunch of NULs in the output. I have
> not been able to find any strange characters returned by the server
> using a logging tcp proxy called ProxyView, however, so that might be a
> bug in the Windows version, or possibly a bug on the part of the test
> program I wrote.
>
> At any rate, the server interoperates as expected with every news reader
> I've tried, including Netscape and KNode, so I am a bit perplexed why
> Java on Linux is have trouble reading from the socket. Reproduction
> should be easy: just open a socket to free.teranews.net on port 119,
> write "list", and read all data until EOF. You should get a list of
> newsgroups if it work, or, if it doesn't, you'll get the Welcome message
> and then EOF.
>
> Has anyone seen this behaviour before. Any workarounds? I've tried
> this with both JDK1.4 and JDK1.5 (beta), and neither work. If you do
> get it to work, would you please post the details of your setup --
> version of Linux, JDK, etc.?
>
> Thanks,
>
> --Nathan Davis
>
- Next message: perry: "Re: Socket returns EOF prematurely"
- Previous message: perry: "Re: Is there a Flash Player or Authorware player written in Java ?"
- In reply to: Nathan Davis: "Socket returns EOF prematurely"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|