In order to remotely access a PostgreSQL database, you must set the two main PostgreSQL configuration files:
postgresql.conf
pg_hba.conf
Here is a brief description about how you can set them (note that the following description is purely indicative: To configure a machine safely, you must be familiar with all the parameters and their meanings)
First of all configure PostgreSQL service to listen on port 5432 on all network interfaces in Windows 7 machine:
open the file postgresql.conf (usually located in C:\Program Files\PostgreSQL\9.2\data) and sets the parameter
listen_addresses = '*'
Check the network address of WindowsXP virtual machine, and sets parameters in pg_hba.conf file (located in the same directory of postgresql.conf) so that postgresql can accept connections from virtual machine hosts.
For example, if the machine with Windows XP have 192.168.56.2 IP address, add in the pg_hba.conf file:
host all all 192.168.56.1/24 md5
this way, PostgreSQL will accept connections from all hosts on the network 192.168.1.XXX.
Restart the PostgreSQL service in Windows 7 (Services-> PosgreSQL 9.2: right click and restart sevice). Install pgAdmin on windows XP machine and try to connect to PostgreSQL.
In addition to above answers suggesting (1) the modification of the configuration files pg_hba.conf and (2) postgresql.conf and (3) restarting the PostgreSQL service, some Windows computers might also require incoming TCP traffic to be allowed on the port (usually 5432).
To do this, you would need to open Windows Firewall and add an inbound rule for the port (e.g. 5432).
Head to Control Panel\System and Security\Windows Defender Firewall > Advanced Settings > Actions (right tab) > Inbound Rules > New Rule… > Port > Specific local ports and type in the port your using, usually 5432 > (defaults settings for the rest and type any name you'd like)
Now, try connecting again from pgAdmin on the client computer. Restarting the service is not required.
This is a complementary answer for the specific case of using AWS cloud computing (either EC2 or RDS machines).
Besides doing everything proposed above, when using AWS cloud computing you will need to set your inbound rules in a way that let you access to the ports.
For PostgreSQL 13, I could not use scram-sha-256 encryption for remote connections for some reason. This worked.
# TYPE DATABASE USER ADDRESS METHOD
local all all scram-sha-256 # "local" is for Unix domain socket connections only
host all all 127.0.0.1/32 scram-sha-256 # IPv4 local connections:
host all all ::1/128 scram-sha-256 # IPv6 local connections
local replication all scram-sha-256 # Allow replication connections from localhost, by a user with the replication privilege.
host replication all 127.0.0.1/32 scram-sha-256
host replication all ::1/128 scram-sha-256
host all all 0.0.0.0/0 trust # <---------- remote connections