Dear wu zhongtao,
Thank you for reaching out to the Microsoft Q&A.
This is a frustrating networking error, but the specific message "An attempt was made to access a socket in a way forbidden by its access permissions" provides a strong clue. Since you've confirmed the network device and other laptops work fine, the issue is isolated to your Windows 11 machine.
You could try following these steps below to solve this issue:
- Create an outbound firewall rule:
- Press the Windows Key and type "Windows Defender Firewall", then open Windows Defender Firewall with Advanced Security.
- In the left pane, click on Outbound Rules.
- In the right pane, click on New Rule....
- Select Port and click Next.
- Select TCP.
- Select Specific remote ports and enter 10081. Click Next.
- Select Allow the connection and click Next.
- Keep all profiles (Domain, Private, Public) checked and click Next.
- Give the rule a name (e.g., "Allow LAN Device 10081") and click Finish.
- After creating the rule, try running your application again. If you use third-party antivirus or firewall, you must check its settings instead, as it likely manages your network rules.
- Check for reserved port ranges:
- Go to Start and type cmd.
- Right-click on Command Prompt and select Run as administrator.
- Run this command:
netsh interface ipv4 show excludedportrange protocol=tcp - This will show you a list of port ranges that are reserved by the system. Check if port 10081 falls within any of these ranges. If it does, this is your problem. This is sometimes caused by features like Hyper-V or recent Windows updates.
- Reset the Network Stack:
- Open Command Prompt as an administrator again.
- Execute the following commands one by one, pressing Enter after each:
netsh winsock reset netsh int ip reset ipconfig /release ipconfig /renew ipconfig /flushdns - Restart your computer after running all the commands and test the connection again.
- Run the Application as an Administrator:
- Right-click the application's executable (.exe) or its shortcut.
- Select Run as administrator.
- If this works, you can right-click the executable, go to Properties > Compatibility tab, and check the box for Run this program as an administrator to make it permanent.
Since you are on a 24H2 Insider Preview build, the problem could be a bug in the operating system itself. Changes to the networking stack or security defaults in new builds can cause unexpected behavior. If none of the above solutions work, you should report the issue via Feedback Hub to help Microsoft identify and fix the problem in a future update.
To assist others who might have similar questions and to help us improve our support system, we kindly encourage you to "Accept the answer" if it successfully addressed your concern. Accepting an answer lets other users know that this solution worked for you, and it also helps us track the effectiveness of our support efforts.
Best regards,
Bryan Vu | Microsoft Q&A Support Specialist