class A extends Thread{
Socket socket=null;
public A(Socket socket){
this.socket=socket;
}
public void run(){
//socket.getInputStream();
do your biz.
}
}class Server extends Thread{
public void run(){
ServerSocket ssocket=....;
while(ssocket!=null){
try{
Socket socket=ssocket.accept();
new A(socket).start();
}catch(.....){}
}
}}
//that's ok.
Socket socket=null;
public A(Socket socket){
this.socket=socket;
}
public void run(){
//socket.getInputStream();
do your biz.
}
}class Server extends Thread{
public void run(){
ServerSocket ssocket=....;
while(ssocket!=null){
try{
Socket socket=ssocket.accept();
new A(socket).start();
}catch(.....){}
}
}}
//that's ok.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货