Performance issue while reading socket

Hi

I am new to java socket reading and am trying to read a AS400 port for the data.

There is a stub that posts the data to this socket which takes 15 milli seconds which is acceptable.

However as a thread that is consistently reading this As400 port reads the data using the following command

in = new BufferedReader(new InputStreamReader(socket.getInputStream()));

It takes 25-30 seconds for reading the data from this port.

How do I know if this is a problem in my coding or a hardwar issue?

Is there a better coding technique for this?

[589 byte] By [DeepakRa] at [2007-11-26 19:12:05]
# 1
> in = new BufferedReader(new InputStreamReader(socket.getInputStream()));I hope that you don't create all those Readers and InputStreams everytime you want to read a couple of bytes from that socket?kind regards,Jos
JosAHa at 2007-7-9 21:10:10 > top of Java-index,Java Essentials,Java Programming...
# 2
>25-30 secondsYup. Java jest wants you to sit a spell. Take your shoes off. Chaw some tobaccah.
DrLaszloJamfa at 2007-7-9 21:10:11 > top of Java-index,Java Essentials,Java Programming...
# 3

while(running){

in = new BufferedReader(new InputStreamReader(socket.getInputStream()));

long strtDt = System.currentTimeMillis();

String clientString = in.readLine();

long reqDt = System.currentTimeMillis();

//Process clientString

}

It takes a lot of time for

String clientString = in.readLine();

Can you pls. advise

DeepakRa at 2007-7-9 21:10:11 > top of Java-index,Java Essentials,Java Programming...
# 4
See reply #1 again. You're throwing away most of your data by constantly recreating the readers. Move the reader creation out of the loop!
ejpa at 2007-7-9 21:10:11 > top of Java-index,Java Essentials,Java Programming...