Re: Connection log entries - random port number recorded

From: Richard Huxton <dev(at)archonet(dot)com>
To: mike(at)thegodshalls(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Connection log entries - random port number recorded
Date: 2004-05-27 07:55:22
Message-ID: 40B59EEA.9020002@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

mike g wrote:
> Hello,
>
> I have postgres set to log all connections. I run it on port 5432. I
> have noticed in the postgres logs that the port being used to connect to
> the database is logged but never equal to 5432. The ip address recorded
> is correct but the port number recorded is always a different number
> each time.

This is entirely normal. The database listens on port 5432, but the
client will connect *from* a randomly chosen port (it's not actually
random, but it is meaningless).

You can't have two connections with the same endpoints, i.e. if you open
up one connection and it goes:
client:12345 => server:5432
then the next outbound connection will have to use a different port e.g.
client:12346 => server:5432

On linux you can use "lsof -i" to see all current connections, I used to
use something similar on Windows, but can't remember what it was.

HTH
--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rory Campbell-Lange 2004-05-27 11:15:59 Naive schema questions
Previous Message Hale 2004-05-27 05:19:12 connecting to an external postgresql db