Article View: borland.public.jbuilder.java.language
Article #747port availability
From: Alan Shiers
Date: Sat, 06 Nov 2004 20:28
Date: Sat, 06 Nov 2004 20:28
15 lines
1537 bytes
1537 bytes
Hi there, When working with a multi-threaded application that involves the use of the ServerSocket class; the ServerSocket class takes an integer as an arguement for a Port Number. 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? I'm thinking maybe using a queue for the port or simply providing a different port if one is already being used. How does one generally tackle this problem? How does one query a port? Alan
Technical Details
Message-ID:
<418d3dc6@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-in.ntli.net!newsrout1-win.ntli.net!ntli.net!newsfeed.wirehub.nl!194.72.7.126.MISMATCH!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: f74b3,deac63f97d065228,start 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 Subject: port availability Date: Sat, 6 Nov 2004 16:28:19 -0400 Lines: 18 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: <418d3dc6@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1099775430 24.222.101.2 (6 Nov 2004 13:10:30 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-in.ntli.net!newsrout1-win.ntli.net!ntli.net!newsfeed.wirehub.nl!194.72.7.126.MISMATCH!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail