Ingres Net Ports

From:	Peter Philipp [mailto:pap@zip.com.au]
Subject:	INGRES NET TCP/IP Port Number

Ingres 6.4/06 patch level 5506 on HP-UX 10.20

Our network administrator wants to give priority to INGRES connections
across our WAN and needs to know what TCP/IP port INGRES NET uses.

This is so the online performance of our application will
not be affected as much by Email, remote copies .....

I have seen, when doing a ingprenv, what looks like a port number
environment variable which was set to the value of something like 1040.

What I need to know is:
a)	Is this the TCP/IP port number, if not how do I get it ?
b)	Is the port number is static, if not, what is it's range and can
	you control it ?

Thanks
Peter


Peter,

As with most TCP/IP software Ingres listens on one socket/port and responds
on another. In a typical installation the listen address, II_INSTALLATION,
is used as the receptor and will equate to a port address from 16904 to
30152 ( AA to Z9 ). All clients will use this socket, as well as others
should other GCC processes be running? In order to work this out yourselves
there is a C program that converts listen addresses from their Alpha form to
the TCP/IP socket, this is available via support as Star Solution 'INGNET
6.4/00 #18'. 

For the outgoing connection made to the client it is not possible to
determine what socket before it is created, only that it has an id of 65535
or greater. I am not certain if other applications (telnetd www server, ftpd
etc...) use this range but I would guess that it is quite possible. Only
that the likelihood is dependant on the purpose of your Ingres machine.

If any one wants I can post the source to of this program to this
newsgroup/mailing list, non binary format.

Hope this helps, regards

grant

ps the GCC listen socket can also be taken from the
$II_SYSTEM/ingres/files/errlog.log file.


  grant.croker@cai.com
Computer Associates UK
Tel : +44 (0)1753 679154 - Fax : +44 (0)1753 679111 - Mobile : +44 (0)7801
916524




a) no.  It's the name server port number, and you're connected to the name
server for only a short time.

b) uh.  I think what you need is the net server port number, and the simplest
way to get it is to run iinamu and say "show comsvr".  The number that you
see is the port number.  I believe it's static based on the listen address
that you define when you do the ingres/net setup with netutil, however I
don't know the algorithm.  (It was posted here quite a long time ago, but I
never needed to know.)  I have a bad feeling about what you are trying to
do, but good luck...



Karl R. Schendel, Jr.
K/B Computer Associates   schendel@kbcomputer.com
Ingres and Unix Expertise

President, North American Ingres Users Association
president@naiua.org


		

Philip

No - the port you see in ingprenv will be something like 

II_GCNhp_PORT=1572

This is the port of the name server for this installation. The name server
holds a register of ports for ingres processes. So -

$iinamu                               
INGRES NAME SERVICE MANAGEMENT UTILITY --

-- Copyright (c) 1989, 1991 Ingres Corporation

IINAMU> show

INGRES    *               12690                 {DBMS port)
IINAMU> show comsvr

COMSVR    *               12651                 {gcc port}             
COMSVR    *               12656                                         
IINAMU>

However these ports are only used for inter-process communication. The port
no for the gcc's will only send/receive control info not data.

For the tcp port look for a message something like this in your errlog.log
after startup -

hplive::[/tmp/ii.9904    , 0000FFFF]: Sat Jun  5 18:01:39 1999
E_GC2815_NTWK_OPEN  Network open complete for protocol TCP_IP, port hp0(20608).

Here the gcc with listen address hp0 is on port 20608. This is the data one.
It is different every time you start a gcc and as far as I know there is no
way to control which ones it uses. 

We use this info in conjunction with netstat to count the number of users on
each gcc. 

I am not a Sys Admin and I am not an expert on TCPIP so I've probably used
the word port where I mean socket or something.

Paul Mason
NICL 
Technical Support - Database Administration




Hi Peter,

you can find the TCP port ID by searching your errlog.log file for TCP or
E_GC2815. You'll find a message like 'Network open complete for protocol
TCP_IP, port ...'. The TCP port ID is static and depends on your listen
address (II_INSTALLATION).

Kind regards

Sarkaut Mohn
Technical Support
Computer Associates, Germany




Hello Sarkaut, and Peter.

Ingres usually gets the TCP port number from the INSTALLATION _ID,
which defaults to "II", giving a TCP port number of 21064..
An Installation ID of "IJ" gives 21072,  i.e 8 more, since there are
up to 8 subports on each listen address. ie, you can run ( up to 8 )
multiple GCCs

These are the Ingres Net connection addresses in Netutil.

If you wish to translate Ingres Listen Addresses to TCP port numbers,
here's a little piece of "C"  
This algorithm is well known, and originally developed by NCC,
according to my notes ( National Computing Centre ??? ).

I made it for my own use, so no guarantees, but it does demonstrate
the algorithm !



/*
	Alan.J.Thackray
	Computer Associates International

	The following code shows the translation from
	Installation ID to TCP port number.
	The default port is "II" which translates to 21064

	Enter arguments in the form
	porttest
	porttest II
	porttest II1
	porttest II 1
*/
 
#include 
#include 

#define FAIL 1

main ( int  argc, char* argv[] ) 
{
	char	input[6] ;
	char	input2[6] ;
	char	p[3];
	int	subport;
	int	output;

/* default values */
strcpy ( input, "II" );
strcpy ( input2, "0" );

if ( argc >  3  )
	{
	printf ("too many args\n");
	exit (FAIL);
	}
if ( argc > 2 )	/* A subport is specified */
	{
	strcpy ( input2, argv[2] );
	input2[1] = '\000' ;
	if ( isdigit (  (int)input2[0]  ) )
		{
		printf (" argv[2] = %s\n", argv[2] ) ;
		subport = atoi ( argv[2] );
		printf ("subport %d\n", input2 );
		}	
	}
if ( argc > 1 )	/* A Port, but no subport specified */
	{
	strcpy ( input, argv[1] );
	strcpy ( input2, "0" );	
	}



p[0] = input[0] ;
p[1] = input[1] ;

if ( isdigit ( input[2] ) )	/* input of the form "IIn" */
	{
	p[2] = input[2];
	}
else
	{
	p[2] = subport & 0x7 ;
	}

	/* Here is the output TCP port */ 
output = 1 << 14
	| ( p[0]  & 0x1f ) << 9
	| ( p[1] & 0x3f ) << 3
	| ( p[2]& 0x07 ) ;

printf (" Ingres Port = %s\n", input );
if ( argc > 2 ) printf ("Subport = %s\n", input2 );
printf (" TCP  port number is %d\n", output );
} 
Ingres Q & A
Back to William's Home Page

© William Yuan 2000

Email William