microsoft / WSA

Developer-related issues and feature requests for Windows Subsystem for Android
MIT License
1.58k stars 841 forks source link

Inconsistent behavior with sockets #503

Open jerry-sands opened 10 months ago

jerry-sands commented 10 months ago

Steps to reproduce

When activating "Local network access", in which Windows and WSA get the same IP address, we can't communicate between two running apps using sockets. We can communicate with a TCP socket we opened in WSA from Windows. When deactivating "Local network access", the apps can communicate over sockets, but we cannot communicate between WSA and Windows.

In both scenarios, we try to connect to localhost and a specific port.

Before the "Local network access" feature was available, the workaround shown in issue #213 did work as expected.

✔️ Expected Behavior

When activating "Local network access" we should be able to communicate both between apps and between WSA and Windows.

❌ Actual Behavior

"Local network access" prevents the localhost communication inside WSA.

Other Software

No response

Please specify the version of Windows Subsystem for Android

2310.40000.2.0

jerry-sands commented 9 months ago

UPDATE:

I use Java's ServerSocket to create a socket that listens to a specific port (without specifying the interface or the IP address). Before the "Local network access" feature was available, when I was listening to a port in all interfaces with the previous "Advanced Networking" mode, I could connect to that port by creating a Socket client that connects to 127.0.0.1 and that port. Unfortunately, now with the "Local network access" feature, the Socket client cannot connect to the server socket.

I used netcat (the nc command) to test the functionality of inner communication in WSA and saw the following: