Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #34567

Re: Picking an unused port number

Path csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Nigel Wade <nmw@ion.le.ac.uk>
Newsgroups comp.lang.java.programmer
Subject Re: Picking an unused port number
Date Wed, 8 Jun 2016 15:06:12 +0100
Lines 26
Message-ID <drqn2lFeao4U1@mid.individual.net> (permalink)
References <gIGdna5umL551yLRRVn_vwA@giganews.com> <e72b1da8-383c-4a75-9d47-6f4cd0993b2a@googlegroups.com> <niv172$pns$1@dont-email.me> <bba8bc85-7414-4d32-aba8-07d8f54a4c93@googlegroups.com> <nj4u4n$siu$1@dont-email.me> <drnfpkFp1n5U1@mid.individual.net> <nj6miv$1oi$1@dont-email.me> <drob1bFueveU1@mid.individual.net> <nj6tek$so7$1@dont-email.me> <drq71jFb52jU1@mid.individual.net> <03e15ba6-ffca-4dff-b10e-4fb184d89bb6@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net jwfhX0us/vWeIQijwLATDAa07jMhjtFNzL401tzxQ4xD10iV+V
Cancel-Lock sha1:yudwr5iV5f+fgsD+6UgXDDztOSw=
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0
In-Reply-To <03e15ba6-ffca-4dff-b10e-4fb184d89bb6@googlegroups.com>
Xref csiph.com comp.lang.java.programmer:34567

Show key headers only | View raw


On 08/06/16 14:45, Eric Douglas wrote:
> On Wednesday, June 8, 2016 at 5:32:46 AM UTC-4, Nigel Wade wrote:
>> One more point. The rmiregistry is not necessarily an external application which you have to run separately. You can
>> make your server application its own rmiregistry, or use an external registry is one is available.
>>
>> All that's required for RMI to work is that the client knows what port the rmiregistry (with which the RMI server has
>> registered) is listening on. After that the rest is up to you. You can make your server an RMI server, or just use an
>> RMI wrapper to deliver the assigned port number to the client, which can then use that port number to connect to a
>> traditional Socket server. Once RMI is being used you can add as many services to it as you deem necessary.
>>
>> My main usage for RMI is delivering real-time radar data to the internet. Each data channel from each radar has a
>> separate RMI server, each of which register with the rmiregistry. When a client wants data from a particular radar it
>> queries rmiregistry to get a Remote interface to the RMI server. This interface includes the methods for requesting data
>> from the RMI server.
>>
>> Personally, I don't trust rmiregistry over the Internet, so rmiregistry is blocked by the firewall for anything other
>> than local networks. For remote access I use a GenericServlet inside Tomcat which accepts requests, uses rmiregistry to
>> locate the relevant radar data server, reads the requested data and returns the result as a serialized Java object.
>
> Google "dynamic Java socket port" and you'll find you can just set the port = 0 and Java will assign you the next available port number to avoid conflict.  Then you just need an alternate method (query web server?) to get the current port for the client connection.
>

Yes, I know how to get a ephemeral port number.

Why use a web server when you can use an RMI server? It's dynamic, and can be completely contained within your application.

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Picking an unused port number nathanturner369@gmail.com - 2016-06-04 08:24 -0700
  Re: Picking an unused port number Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2016-06-04 09:56 -0700
    Re: Picking an unused port number Eric Douglas <e.d.programmer@gmail.com> - 2016-06-06 05:28 -0700
      Re: Picking an unused port number Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2016-06-06 15:40 -0700
        Re: Picking an unused port number Nigel Wade <nmw@ion.le.ac.uk> - 2016-06-07 09:43 +0100
          Re: Picking an unused port number Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2016-06-07 07:43 -0700
            Re: Picking an unused port number Nigel Wade <nmw@ion.le.ac.uk> - 2016-06-07 17:28 +0100
              Re: Picking an unused port number Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2016-06-07 09:40 -0700
                Re: Picking an unused port number Nigel Wade <nmw@ion.le.ac.uk> - 2016-06-08 10:32 +0100
                Re: Picking an unused port number Eric Douglas <e.d.programmer@gmail.com> - 2016-06-08 06:45 -0700
                Re: Picking an unused port number Nigel Wade <nmw@ion.le.ac.uk> - 2016-06-08 15:06 +0100
                Re: Picking an unused port number Eric Douglas <e.d.programmer@gmail.com> - 2016-06-08 07:36 -0700
                Re: Picking an unused port number Martin Gregorie <martin@address-in-sig.invalid> - 2016-06-08 18:03 +0000
  Re: Picking an unused port number Jerry Stuckle <jstucklex@attglobal.net> - 2016-06-04 20:50 -0400
    Re: Picking an unused port number Wayne <wayne@nospam.invalid> - 2016-06-06 18:44 -0400
      Re: Picking an unused port number Jerry Stuckle <jstucklex@attglobal.net> - 2016-06-06 20:52 -0400
        Re: Picking an unused port number Arne Vajhøj <arne@vajhoej.dk> - 2016-06-06 21:28 -0400
          Re: Picking an unused port number Jerry Stuckle <jstucklex@attglobal.net> - 2016-06-06 21:45 -0400
            Re: Picking an unused port number Arne Vajhøj <arne@vajhoej.dk> - 2016-06-06 23:07 -0400
              Re: Picking an unused port number Jerry Stuckle <jstucklex@attglobal.net> - 2016-06-07 09:50 -0400
                Re: Picking an unused port number Lew <lewbloch@gmail.com> - 2016-06-07 13:46 -0700
                Re: Picking an unused port number Jerry Stuckle <jstucklex@attglobal.net> - 2016-06-07 19:31 -0400
                Re: Picking an unused port number Lew <lewbloch@gmail.com> - 2016-06-07 17:26 -0700
                Re: Picking an unused port number Jerry Stuckle <jstucklex@attglobal.net> - 2016-06-07 21:34 -0400
                Re: Picking an unused port number Lew <lewbloch@gmail.com> - 2016-06-08 13:52 -0700
                Re: Picking an unused port number Jerry Stuckle <jstucklex@attglobal.net> - 2016-06-08 17:49 -0400
                Re: Picking an unused port number Arne Vajhøj <arne@vajhoej.dk> - 2016-06-07 21:53 -0400
        Re: Picking an unused port number a.laforgia@gmail.com - 2016-06-07 00:11 -0700

csiph-web