An easier approach would be to bridge the network interfaces of the virtual machines to the local network (if you don't mind exposing both virtual machines to the local network). That way, they will both be given an address on the local network and will be able to talk to each other.
This is done by selecting 'Host Interface' rather than 'NAT' (which actually means to bridge to the host interface). Note that for earlier versions of VirtualBox (prior to 2.1.0) this feature was not available, and had to be done manually from the host system using tunctl
(see also here
). (for people running Debian Lenny, have a look at backports.org for a 2.1.x version of VirtualBox).
If you really just want to connect up the two VirtualBox instances with each other (without access to the external network), then select 'internal network' rather than 'NAT'. This might be relevant if you were using VirtualBox to provide a closed test environment for your server/client pair.