我现在做的是一个关于socket的程序,
public class Server{
SecondServer secondServer=new SecondServer(端口);
Thread thread=new Thread(secondServer);
thread.start();
}
pubblic class SecondServer implements Runnable{
public SecondServer(int port){
监听一个端口
}
public void run(){
LoadServer secondServer=new LoadServer (端口);
Thread thread=new Thread(secondServer);
thread.start();}}
public class LoadServer implements Runnable{
public LoadServer (int port){
监听一个端口
}
public void run(){
下载程序
}
}Server是服务器程序 一直开着,如果客户端一直调用 ,如何才能避免端口已被占用的情况 急 请哪位大虾指点一下 谢谢了
public class Server{
SecondServer secondServer=new SecondServer(端口);
Thread thread=new Thread(secondServer);
thread.start();
}
pubblic class SecondServer implements Runnable{
public SecondServer(int port){
监听一个端口
}
public void run(){
LoadServer secondServer=new LoadServer (端口);
Thread thread=new Thread(secondServer);
thread.start();}}
public class LoadServer implements Runnable{
public LoadServer (int port){
监听一个端口
}
public void run(){
下载程序
}
}Server是服务器程序 一直开着,如果客户端一直调用 ,如何才能避免端口已被占用的情况 急 请哪位大虾指点一下 谢谢了
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货