Home arrow static arrow Java Programming [Archive] - close specific port
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - close specific port
This topic has 5 replies on 1 page.

Posts:36
Registered: 7/23/04
close specific port  
Jul 30, 2004 3:34 PM



 
How can i close specific port?
for example i wont close port(1025) .
 

Posts:27,518
Registered: 11/3/97
Re: close specific port  
Jul 30, 2004 4:13 PM (reply 1 of 5)



 
You can't without a lot of OS specific work and it probably isn't something that java is well suited for except prehaps as the management gui.

Basically on a single computer you need to 'insert' a proxy server in between normal processes and the network stack. As a proxy server you can control all of the traffic.
 

Posts:36
Registered: 7/23/04
Re: close specific port  
Jul 30, 2004 4:35 PM (reply 2 of 5)



 
i wont close the port in my pc not in the network
 

Posts:36
Registered: 7/23/04
Re: close specific port  
Jul 30, 2004 8:25 PM (reply 3 of 5)



 
Help!!!!
 

Posts:37,103
Registered: 3/30/99
Re: close specific port  
Jul 30, 2004 9:32 PM (reply 4 of 5)



 
What do you mean you want to "close the port"?

Are you saying you want to close an open connection to that port? I don't think you can do that from Java (without JNI) if it's not your app that opened the connection.

Are you saying you want to prevent any clients from connecting to that port? Then don't open a ServerSocket on it.

Are you saying you want to prevent any app from listening on that port? The cheap and dirty way is for your app to create a ServerSocket on that port, do nothing with it, and never let it go. A better way is with firewall software or whatever built-in network management software your OS has.
 

Posts:27,518
Registered: 11/3/97
Re: close specific port  
Aug 2, 2004 11:25 AM (reply 5 of 5)



 
i wont close the port in my pc not in the network

Which is exactly what my previous response was referring to.

Which part of it did you not understand?
 
This topic has 5 replies on 1 page.