Are you running VMs in VirtualBox or VMWARE workstation on laptop?
First you need to test if both VMs are reachable to each other with Ping command instead of just trying with code. To check destination port is open or not, you can test with old Telnet command like
telnet <destination_ip>
Also, make sure you are putting both VMs in same subnet if running on laptop.O
Basic rule of networking is that, either hosts need to be in same subnet or they can communicate via Layer 3 device.