Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

How to retrieve port number on which a ASA server is running?

2 posts in General Discussion Last posting was on 2008-01-02 14:51:29.0Z
Shreyas Ganesh Posted on 2007-12-31 04:24:48.0Z
From: "Shreyas Ganesh" <shreyasganesh@gmail.com>
Newsgroups: ianywhere.public.general
Subject: How to retrieve port number on which a ASA server is running?
Lines: 53
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: charger.intuit.com
X-Original-NNTP-Posting-Host: charger.intuit.com
Message-ID: <47786f10@forums-1-dub>
Date: 30 Dec 2007 20:24:48 -0800
X-Trace: forums-1-dub 1199075088 208.240.243.170 (30 Dec 2007 20:24:48 -0800)
X-Original-Trace: 30 Dec 2007 20:24:48 -0800, charger.intuit.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:6656
Article PK: 4904

Hi,

We run Sybase DB Server in Network Mode (communication happens over
TCP/IP) and we have app talking to this DB Server. We use Sybase iAnywhere.
Right now app
starts the DB Server at a particular fixed port and always and who
ever needs to ping the DB Server can directly ping at that portno
because it is hard-coded per release and is know to every client.
Now we are changing this port where DB Server needs to be started to a
Dynamic port, as result of this we need following information


1. Is there anyway, if DB Server is running on a particular machine M1
(who's IP is known) we can get Portno where this DB server is running
we know the server name also. And note that even if it stores port nos
in a table we don't have much use unless there is an api which takes
DB Server Name and Machine to get the port no where it is running
because to connect to DB and start queering we need to know which port
the DB server is running.


2. Can Sybase iAnywhere server listen on a dynamic tcp port number for
communicating with the applications? To explain further on this, the
startup string for the server we are using is "..... -x
tcpip(BroadcastListener=NO;port=10280)". Here as you can see we are
specifying the tcp port number that Sybase DBServer should listen on.
Is it possible instead of us giving a fixed port number but Sybase to
listen on a dynamically generated port number (generated by itself)
and then let the application know of this number somehow? Does this
feature exists already?


3) Is there a way to query a running Sybase ASA server about what is
its listening TCP port?


4) Before Sybase ASA server listens on the port, is it possible for
any plug-in DLL to intervene and provide a dynamically generated tcp
port for it to listen on? Just a variation on question 2) to see
whether we can do something.


5) I hear there is a stored procedure in ASA that returns the port number on
which the db server is running. Could you please trell me the name of that
stored proc?

Would really appreciate it if you direct me to relevant document links with
answers to these questions.

Thanks in advance
Shreyas


Graeme Perrow Posted on 2008-01-02 14:51:29.0Z
From: Graeme Perrow <ReplyToNewsgroupOnly-gperrowNO@SPAMianywhere.PLEASEcom>
Reply-To: ReplyToNewsgroupOnly-gperrowNO@SPAMianywhere.PLEASEcom
Organization: iAnywhere Solutions
User-Agent: Thunderbird 2.0.0.9 (Windows/20071031)
MIME-Version: 1.0
Newsgroups: ianywhere.public.general
Subject: Re: How to retrieve port number on which a ASA server is running?
References: <47786f10@forums-1-dub>
In-Reply-To: <47786f10@forums-1-dub>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: gperrow-d830.sybase.com
X-Original-NNTP-Posting-Host: gperrow-d830.sybase.com
Message-ID: <477ba4f1$1@forums-1-dub>
Date: 2 Jan 2008 06:51:29 -0800
X-Trace: forums-1-dub 1199285489 10.25.106.211 (2 Jan 2008 06:51:29 -0800)
X-Original-Trace: 2 Jan 2008 06:51:29 -0800, gperrow-d830.sybase.com
Lines: 66
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:6658
Article PK: 4907


Shreyas Ganesh wrote:
> 1. Is there anyway, if DB Server is running on a particular machine M1
> (who's IP is known) we can get Portno where this DB server is running
> we know the server name also. And note that even if it stores port nos
> in a table we don't have much use unless there is an api which takes
> DB Server Name and Machine to get the port no where it is running
> because to connect to DB and start queering we need to know which port
> the DB server is running.

Unless you are (a) trying to connect through a firewall, (b) trying to
connect over a WAN, or (c) trying to run more than one server on a
single machine, you can remove the port number stuff from both the
client and server. The server will attempt to use port 2638, but if that
port is in use, it will use the first unused port starting at 49152. If
the client uses broadcasting or LDAP to find the server, it will find it
regardless of the port number.

If you are using a firewall or connecting over a WAN and you cannot use
2638, both client and server must know the port number ahead of time.
Otherwise, the client would have to connect to the server in order to
find the port number -- but it can't connect to the server without
knowing the port number in advance.

> 2. Can Sybase iAnywhere server listen on a dynamic tcp port number for
> communicating with the applications? To explain further on this, the
> startup string for the server we are using is "..... -x
> tcpip(BroadcastListener=NO;port=10280)". Here as you can see we are
> specifying the tcp port number that Sybase DBServer should listen on.
> Is it possible instead of us giving a fixed port number but Sybase to
> listen on a dynamically generated port number (generated by itself)
> and then let the application know of this number somehow? Does this
> feature exists already?

Answered above. Remove the port number from the -x option and the server
will choose an available port. Broadcasts over the LAN will still find
the server.

> 3) Is there a way to query a running Sybase ASA server about what is
> its listening TCP port?

Beginning with version 10.0.0, you can use "select
property('ServerPort')" to find the port on which the server is listening.

> 4) Before Sybase ASA server listens on the port, is it possible for
> any plug-in DLL to intervene and provide a dynamically generated tcp
> port for it to listen on? Just a variation on question 2) to see
> whether we can do something.

No.

> 5) I hear there is a stored procedure in ASA that returns the port number on
> which the db server is running. Could you please trell me the name of that
> stored proc?

Answered above. Use property('ServerPort').

--

Graeme Perrow
Senior Software Developer
gperrow _at_ ianywhere _dot_ com
iAnywhere Solutions Inc.
A Sybase company

Whitepapers, TechDocs, bug fixes are all available through the iAnywhere
Developer Community at http://www.ianywhere.com/developer/