title: How to connect through socket to Virtual Machine
body: <p>I have a java client on Windows and c++ server running on Linux (VM). I'm trying to connect client to the server. But I don't know what IP address I should use. 
  My Virtual Machine configuration is default, I have NAT network on it. 
  Here is what I get from ifconfig</p>
  
  <pre><code>enp0s3    Link encap:Ethernet  HWaddr 08:00:27:97:86:ce 
        inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
        inet6 addr: fe80::8651:2c9d:6683:e4fc/64 Scope:Link
        UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
        RX packets:855910 errors:0 dropped:0 overruns:0 frame:0
        TX packets:267095 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:1000
        RX bytes:940974525 (940.9 MB)  TX bytes:24398399 (24.3 MB)
  
  lo        Link encap:Local Loopback 
        inet addr:127.0.0.1  Mask:255.0.0.0
        inet6 addr: ::1/128 Scope:Host
        UP LOOPBACK RUNNING  MTU:65536  Metric:1
        RX packets:9710 errors:0 dropped:0 overruns:0 frame:0
        TX packets:9710 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:1
        RX bytes:875898 (875.8 KB)  TX bytes:875898 (875.8 KB)
  </code></pre>
  
  <p>And here is what i get from ipconfig:</p>
  
  <pre><code>Ethernet adapter Ethernet:
  
     Media State . . . . . . . . . . . : Media disconnected
     Connection-specific DNS Suffix  . :
  
  Wireless LAN adapter Połączenie lokalne* 2:
  
     Media State . . . . . . . . . . . : Media disconnected
     Connection-specific DNS Suffix  . :
  
  Wireless LAN adapter Wi-Fi:
  
     Connection-specific DNS Suffix  . : home
     Link-local IPv6 Address . . . . . : fe80::ddca:c63d:1b9e:6255%14
     IPv4 Address. . . . . . . . . . . : 192.168.1.3
     Subnet Mask . . . . . . . . . . . : 255.255.255.0
     Default Gateway . . . . . . . . . : 192.168.1.254
  
  Ethernet adapter Połączenie sieciowe Bluetooth:
  
     Media State . . . . . . . . . . . : Media disconnected
     Connection-specific DNS Suffix  . :
  
  Tunnel adapter Połączenie lokalne* 4:
  
     Connection-specific DNS Suffix  . :
     IPv6 Address. . . . . . . . . . . : 2001:0:9d38:90d7:10c9:14d5:da7f:e55c
     Link-local IPv6 Address . . . . . : fe80::10c9:14d5:da7f:e55c%13
     Default Gateway . . . . . . . . . : ::
  </code></pre>
  
  <p>I tried to connect using:</p>
  
  <pre><code>socket = new Socket("10.0.2.15", 1236);
  </code></pre>
  
  <p>When Im using client on VM with localhost everything is fine.</p>
  
  <p>So I assume there is a problem with connection between Windows and VM.</p>