IDE 是eclipse!
在网络编程用Socket的时候TCP端口有时被占用,请问是咋会事!!>>>
如
方法
public void connServer
{
ServerSocket ss = null;
try {
ss= new ServerSocket(TCP_PORT);
} catch (IOException e1) {
e1.printStackTrace();
}finally
{
if(ss!=null)
{
try {
ss.close();
ss = null;
} catch (IOException e) {
e.printStackTrace();
}
}
}
在网络编程用Socket的时候TCP端口有时被占用,请问是咋会事!!>>>
如
方法
public void connServer
{
ServerSocket ss = null;
try {
ss= new ServerSocket(TCP_PORT);
} catch (IOException e1) {
e1.printStackTrace();
}finally
{
if(ss!=null)
{
try {
ss.close();
ss = null;
} catch (IOException e) {
e.printStackTrace();
}
}
}
TCP_PORT设个不常见的端口,10000以上然后就是你运行时,当前这个程序没有关闭,就又运行也会端口被占用