Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SocketException: JVM_recv in socket input

1 view
Skip to first unread message

Karen

unread,
Mar 28, 2002, 11:59:39 PM3/28/02
to
What does all this mean? It keeps on coming up at various times as I am
connecting to a server and retrieving their pages.

java.net.SocketException: Connection reset by peer: JVM_recv in socket input
stream read

at java.net.SocketInputStream.socketRead(Native Method)

at java.net.SocketInputStream.read(SocketInputStream.java:86)

at java.net.SocketInputStream.read(SocketInputStream.java:67)

at java.io.InputStreamReader.fill(InputStreamReader.java:173)

at java.io.InputStreamReader.read(InputStreamReader.java:249)

at java.io.BufferedReader.fill(BufferedReader.java:139)

at java.io.BufferedReader.readLine(BufferedReader.java:299)

at java.io.BufferedReader.readLine(BufferedReader.java:362)

Peter Wu

unread,
Mar 29, 2002, 1:49:37 AM3/29/02
to
What version of JVM do you use?

"Karen" <looking...@hotmail.com> wrote in message
news:a80s6h$pvf$2...@newsg4.svr.pol.co.uk...

Matthew F. Dennis

unread,
Mar 29, 2002, 7:24:04 AM3/29/02
to
It means the connection was closed/reset by the other host. It is similar
to trying to read from a file that is closed.

Matt

"Karen" <looking...@hotmail.com> wrote in message
news:a80s6h$pvf$2...@newsg4.svr.pol.co.uk...

Karen

unread,
Mar 29, 2002, 8:12:38 AM3/29/02
to
I dont know what version I am using JBuilder 6
How do i find out what version? It uses jdk v.3

"Peter Wu" <no.j...@il.net> wrote in message
news:a812q5$ov4g7$1...@ID-117651.news.dfncis.de...

Karen

unread,
Mar 29, 2002, 8:13:08 AM3/29/02
to
Why would the host close the connection? I am d/l ing pages from their site
then it reset connection error and halts my progress and I have to run my
program again and start all over again.

"Matthew F. Dennis" <ma...@merfer.net> wrote in message
news:a81mah$dmr$1...@news.cs.utexas.edu...

Karen

unread,
Mar 29, 2002, 10:15:26 AM3/29/02
to
So it is definitely the host that is closing the connection and not me, the
client somehow? Is it possible to catch this exception and resend my
request so that if this happens, I can retry the request? What ive done is
opened a socket, and got an input stream, then I read each line of the
stream, and appned it to a string buffer.

BufferedReader in = getInputStream();
StringBuffer buff = new StringBuffer(1024*20);
String s;

while((s=in.readLine())!=null) {
buff.append(s);
buff.append(CRLF);
}

The get the connection reset problem occuring. The program is terminiated
at the while ((s=readLine.... line and the next reference is to the
BufferedReader :
public String readLine() throws IOException {
return readLine(false);
}
See my previous post (below) for the thread of errors. Im thinking maybe if
I use a try and catch I can resend the request, can i do this?

Thanks,

K.
x

"Matthew F. Dennis" <ma...@merfer.net> wrote in message
news:a81mah$dmr$1...@news.cs.utexas.edu...

Ken Kalish

unread,
Mar 29, 2002, 9:52:50 PM3/29/02
to
On Fri, 29 Mar 2002 15:15:26 -0000, "Karen" <looking...@hotmail.com>
wrote:

>So it is definitely the host that is closing the connection and not me, the
>client somehow?

yep

> Is it possible to catch this exception and resend my
>request so that if this happens, I can retry the request? What ive done is
>opened a socket, and got an input stream, then I read each line of the
>stream, and appned it to a string buffer.
>
> BufferedReader in = getInputStream();
> StringBuffer buff = new StringBuffer(1024*20);
> String s;
>
> while((s=in.readLine())!=null) {
> buff.append(s);
> buff.append(CRLF);
> }
>
>The get the connection reset problem occuring. The program is terminiated
>at the while ((s=readLine.... line and the next reference is to the
>BufferedReader :
> public String readLine() throws IOException {
> return readLine(false);
> }
>See my previous post (below) for the thread of errors. Im thinking maybe if
>I use a try and catch I can resend the request, can i do this?

yes, catch the SocketException - but it would be a good idea to not get caught
in an infinite number of retries, so you'd want to set a limit.

You can demonstrate the behavior for yourself, by using a simple server
program (with ServerSocket and Socket) and a simple client program (with
Socket). Start each from a separate dos window. Once the connection is
established, close out one side or the other with ctrl-C and observe the
exception in the other side.

>
>Thanks,
>
>K.
>x
>
>"Matthew F. Dennis" <ma...@merfer.net> wrote in message
>news:a81mah$dmr$1...@news.cs.utexas.edu...
>> It means the connection was closed/reset by the other host. It is similar
>> to trying to read from a file that is closed.
>>
>> Matt
>>
>> "Karen" <looking...@hotmail.com> wrote in message
>> news:a80s6h$pvf$2...@newsg4.svr.pol.co.uk...
>> > What does all this mean? It keeps on coming up at various times as I am
>> > connecting to a server and retrieving their pages.
>> >
>> >
>> >
>> > java.net.SocketException: Connection reset by peer: JVM_recv in socket
>> input
>> > stream read
>> >
>> > at java.net.SocketInputStream.socketRead(Native Method)
>> >
>> > at java.net.SocketInputStream.read(SocketInputStream.java:86)
>> >
>> > at java.net.SocketInputStream.read(SocketInputStream.java:67)
>> >
>> > at java.io.InputStreamReader.fill(InputStreamReader.java:173)
>> >
>> > at java.io.InputStreamReader.read(InputStreamReader.java:249)
>> >
>> > at java.io.BufferedReader.fill(BufferedReader.java:139)
>> >
>> > at java.io.BufferedReader.readLine(BufferedReader.java:299)
>> >
>> > at java.io.BufferedReader.readLine(BufferedReader.java:362)
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>>
>>
>

--

Regards,

Ken Kalish

there is no Java cartel

Karen

unread,
Mar 30, 2002, 8:26:34 PM3/30/02
to


When I catch the exception, how do I resend the request? I have caught the
exception and resend the request by sending my get headers again, but the
socket doesnt respond and I dont read anything from the read reseponse
stream.... if (buff.length()==0) and enters this loop instead of entering
the readLine stream. I think maybe I have to wait a while and then resend
the request when the host is ready, but how can I program this in?

Thanks.

K
x.

Esmond Pitt

unread,
Mar 31, 2002, 11:16:16 PM3/31/02
to

Karen wrote:
>
>
> When I catch the exception, how do I resend the request?

Make a new connection (a new Socket). The old one is dead and useless.

EJP

0 new messages