receiving information using a socket
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   ken_carey
Posted On:   Tuesday, April 8, 2003 04:36 AM

Hello I have a simple java client application that receives data from another java app through a socket. I want the client app to listen for any received data using a thread. Something like this : void run() { BufferedReader inbound = new BufferedReader( new InputStreamReader(sock.getInputStream()) ); // Read the response String responseLine; while ((responseLine = inbound.readLine()) != null) { java.lang.System.out.println(responseLine); } sleep(100) } Is this a typical approach people take. Any suggustions would be greatly appreciated . Th   More>>

Hello


I have a simple java client application that receives data from another java app through a socket. I want the client app to listen for any received data using a thread. Something like this :



void run() {


BufferedReader inbound = new BufferedReader(
new InputStreamReader(sock.getInputStream()) );


// Read the response

String responseLine;

while ((responseLine = inbound.readLine()) != null)

{

java.lang.System.out.println(responseLine);

}


sleep(100)


}



Is this a typical approach people take. Any suggustions would be greatly appreciated .


Thanks


Ken.

   <<Less
About | Sitemap | Contact