Problem in socket
Guys I need your help ?br>Scenario is this I had open a socket connection from servlet ( sun application server ) ?and connection made successfully..
Even I can write through this socket connection ?but when I try to read data from this open connection its always return available byte zero.\
So I am not able read any data. ?Do I need to make some setting on application server level for retrieving data ?
Code that is like this ?.
void startClient(){
Socket client = null;
InputStream in = null;
OutputStream out = null;
try {
client = new Socket("10.208.10.44",2345);
in = client.getInputStream();
out = client.getOutputStream();
boolean read_status = true;
while(read_status == true){
int avl = in.available();
System.out.println("number of bytes avialable is " +avl );
if(avl > 0){
byte[] data = new byte[avl];
int read_amount = in.read(data);
System.out.println("number ob byte read " +read_amount );
System.out.println(" data read is " + new String(data) );
}
else if(avl == 0){
Thread.sleep(2000);
}
else{
read_status = false;
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
Guys Please Reply ? Thanks

