日期:2014-05-20  浏览次数:21017 次

recv failed
我想做个代理服务器,可到这一部就出错了,
麻烦各位帮帮忙,谢谢
import   java.net.*;
import   java.io.*;
public   class     HttpProxy   extends   Thread
{
protected   Socket   sock;  
 

public   void   run(){
System.out.println( "线程启动! ");

try{
InputStream   is=sock.getInputStream();

BufferedReader   in=new   BufferedReader(new   InputStreamReader(is));
 

 
System.out.println(in.readLine());   ///这里为什么会出错啊???
 


 
}catch(Exception   e){
System.out.println( "出错2! ");
e.printStackTrace();
try{sock.close();}catch(Exception   ex){System.out.println( "出错3! ");};
}
 
}


public   HttpProxy(Socket   s){
sock=s;
}
public   static   void   main(String[]   args)  
{
System.out.println( "启动代理服务器! ");  

ServerSocket   ssock;
Socket   sock;
try{
ssock=new   ServerSocket(800);
while(true){
sock=ssock.accept();//
(new   HttpProxy(sock)).start();
}
}catch(Exception   e){
e.printStackTrace();
}

}
 
 
 

 
}


------解决方案--------------------
帮顶下