Google Grupper har inte längre stöd för nya Usenet-inlägg eller -prenumerationer. Historiskt innehåll förblir synligt.
Dismiss

SocketException: JVM_recv in socket input

1 visning
Hoppa till det första olästa meddelandet

Karen

oläst,
28 mars 2002 23:59:392002-03-28
till
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

oläst,
29 mars 2002 01:49:372002-03-29
till
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

oläst,
29 mars 2002 07:24:042002-03-29
till
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

oläst,
29 mars 2002 08:12:382002-03-29
till
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

oläst,
29 mars 2002 08:13:082002-03-29
till
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

oläst,
29 mars 2002 10:15:262002-03-29
till
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

oläst,
29 mars 2002 21:52:502002-03-29
till
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

oläst,
30 mars 2002 20:26:342002-03-30
till


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

oläst,
31 mars 2002 23:16:162002-03-31
till

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