Best practice for setting port on DBMonitor

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
mikeho
Posts: 41
Joined: Thu 11 Nov 2004 21:23
Location: Middle Tennessee USA

Best practice for setting port on DBMonitor

Post by mikeho » Thu 04 Jun 2015 17:16

Going old school with DBMonitor here... :)

When multiple people open a DBmonitor session, right now the first session open captures ALL the messages because the port # is defaulted to 1000.

Is there a best practice to automatically set the OraSQLMonitor.DBMonitorOptions.Port each time an app runs so that each developer can see their messages on their monitor? Currently I am doing:

FPid: integer;

FPid := Integer(GetCurrentProcessID) mod MAXWORD; // This makes sure it is limited to Max Windows Ports
OraSQLMonitor.DBMonitorOptions.Port := FPid;

Then in a Oracle Information pop up I have, I have added the Port # information for the user to set in DBMonitor.

Problem is that this may get into standard TCP/IP Ports (21, 80, 8000, 8080, etc.)

Any thoughts on a better process?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Best practice for setting port on DBMonitor

Post by AlexP » Tue 09 Jun 2015 08:59

Hello,

In addition to that you can get standard ports on random selection, the retrieved port may be blocked by antivirus, firewall or another process. So, to ensure getting a free port, you should also check ports (port scanner).

mikeho
Posts: 41
Joined: Thu 11 Nov 2004 21:23
Location: Middle Tennessee USA

Re: Best practice for setting port on DBMonitor

Post by mikeho » Mon 15 Jun 2015 19:54

Well we went another route. We decided to incorporate a circular Oracle sequence of 3000 or so numbers that we knew were not used as standard tpc/ip ports within Windows.

Now we just get the NextVal from the sequence and adjust the Port on the DBMonitor,

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Best practice for setting port on DBMonitor

Post by AlexP » Tue 16 Jun 2015 08:03

As I wrote earlier, you can use any method for port number retrieving. However, without a check for availability, this port may already be busy or locked.

Post Reply