Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2007

Tip: Looking for answers? Try searching our database.

Limiting number of ports in VM to a range

Thread view: 
Hung - 27 Feb 2007 17:55 GMT
Hi there,

  Trying to setup a vm server which accepts incoming connections.  Is
there a way of limiting the range of clients ports used by the vm
during the connection creation with the connecting clients?

  I've looked at SocketPermissions, it looks like what I want...but
not 100% sure.
Gordon Beaton - 27 Feb 2007 18:24 GMT
> Trying to setup a vm server which accepts incoming connections. Is
> there a way of limiting the range of clients ports used by the vm
> during the connection creation with the connecting clients?

No, you need to accept all incoming connections, but you can close the
ones you don't like based (for example) on Socket.getPort(). I wonder
however what added value this has, considering the complexity it adds
to the client.

The only thing similar to what you are asking is to bind your
ServerSocket to a specific local address, which lets you restrict what
network your clients can connect from.

/gordon

Signature

[ don't email me support questions or followups ]
g o r d o n  +  n e w s  @  b a l d e r 1 3 . s e

Hung - 27 Feb 2007 18:28 GMT
Sorry, I really meant the socket created via the accept() of the
connection from the client application.
So the socket on the same vm running the serversocket.

> > Trying to setup a vm server which accepts incoming connections. Is
> > there a way of limiting the range of clients ports used by the vm
[quoted text clipped - 14 lines]
> [ don't email me support questions or followups ]
> g o r d o n  +  n e w s  @  b a l d e r 1 3 . s e
Gordon Beaton - 27 Feb 2007 19:02 GMT
> Sorry, I really meant the socket created via the accept() of the
> connection from the client application. So the socket on the same vm
> running the serversocket.

Every Socket returned by ServerSocket.accept() uses the *same* local
port as the ServerSocket it came from.

Maybe you could try to describe what problem you're trying to solve,
instead of how you hope to solve it.

/gordon

Signature

[ don't email me support questions or followups ]
g o r d o n  +  n e w s  @  b a l d e r 1 3 . s e



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.