Thanks Ananth.
Fixed the issue. I replaced the localhost with the ip address i,e 127.0.0.1. It started working fine.
I realized that there wasnt any mapping in the host file of vista. Later i mapped the localhost to ip address it started working without any changes in the code.
PS: Vista host file must be changed using the administrative privilege otherwise the changes doesn't reflect.