Article View: borland.public.jbuilder.java.language
Article #749Re: port availability
From: Alan Shiers
Date: Sun, 07 Nov 2004 14:50
Date: Sun, 07 Nov 2004 14:50
44 lines
2792 bytes
2792 bytes
Hi John, Let me run this by you. Does it make sense to use a particular port as a shared resource for a particular purpose? In my case, I have my server app where I want to make available a particular port that clients can use to upload/download files. However, the possible problem arises that several people may be trying to upload/download files on this port at the same time. So, I'm thinking of implementing a queue to test for the availability of the port and process each clients request in turn. Does this make sense? I thought of making available several ports for this purpose, and if one isn't available, use another that is. But this occurred to me if I went this route. What if the server app is behind a firewall and we want to limit the number of available ports for security reasons. Having many holes in the firewall would be potentially dangerous. This is why I'm thinking it best to stick with just the one port for uploading/downloading files. What do you think? Alan "John McGrath [TeamB]" <ng-b@JPMcGrath.net> wrote in message news:xn0dpgfdz8cuc30009@newsgroups.borland.com... > On 11/6/2004 at 3:28:19 PM, Alan Shiers wrote: > > > i.e. ServerSocket socket = new ServerSocket(2500); > > > > Let's assume this port is already being used by another thread. > > Is there some way to check if the port is already active so that > > we can allocate a different port number or at least continue to > > check the port until it becomes free? > > The constructor will throw an exception if the port is in use. > > -- > Regards, > > John McGrath [TeamB] > > --------------------------------------------------- > Before sending me e-mail, please read: > http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<418e369d$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news2.euro.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<418d3dc6@newsgroups.borland.com> <xn0dpgfdz8cuc30009@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,deac63f97d065228 X-Google-Attributes: gidf74b3,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Alan Shiers" <ashiers@hfx.eastlink.ca> Newsgroups: borland.public.jbuilder.java.language References: <418d3dc6@newsgroups.borland.com> <xn0dpgfdz8cuc30009@newsgroups.borland.com> Subject: Re: port availability Date: Sun, 7 Nov 2004 10:50:02 -0400 Lines: 46 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 24.222.101.2 Message-ID: <418e369d$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1099839133 24.222.101.2 (7 Nov 2004 06:52:13 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news2.euro.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail