Thread與Socket阻塞
現在在做一個多線程與Socket配合的問題﹐現在在接受數據端老是過2到3個小時就有一條線程死掉﹐還有兩個類一個是界面啟動線程的﹐一個是對接收數據處理﹐這段程試是兩個死循環﹐外循環是不斷監聽是否有數據傳過來﹐內循環是在數據庫里搜索數據什么處理完并返回信息。望高手能給我點意見﹐不勝感激﹗
public void run()
{
try
{
String readMess= " ";
client=null;
in=null;
out=null;
client =new Socket(ip,port);
//client =new Socket( "10.242.10.75 ",4660);
System.out.println(line+ " CONNECTION OK! ");
out = new DataOutputStream(client.getOutputStream());
in = new DataInputStream(client.getInputStream());
flag=true;
while(true)
{
/*
if(in.available()==0)
{
//break;
continue;
}
*/
System.out.print(line);
System.out.println(client.isConnected());
readMess=in.readLine().trim();
//System.out.println(readMess);
if(readMess.equals( " ")||readMess==null)
{
System.out.println( "while end! ");
break;
}
else
{
if(!client.isConnected())
{