'How to connect from VirtualBox machine to Host windows through ADB?

I'm using Android Studio 2021.1.1 in windows10 and Santoku in VirtualBox 6.13 and i want to connect through ADB tool from Santoku to the Android Emulator that is running in windows.

I have check the ip for the android emulator from adb tool in windows and i got the ip address for the emulator which is

C:\Users\x\AppData\Local\Android\Sdk\platform-tools>adb shell
root@android:/ # ifconfig eth0
eth0: ip 10.0.2.15 mask 255.255.255.0 flags [up broadcast running multicast]

And when i use adb connect 10.0.2.15:5554 in vm it gives me

unable to connect to device

after checked many solutions like these:

How to connect a socket to Genymotion device that is hosting a server?

Connect Genymotion from Another VirtualBox machine with adb

I have an idea about the problem that is i need to set the network adapter from NAT to bridge in Android Emulator but I don't know how to set it up in SDK .



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source