Python connector works over LAN, but not over Wi-Fi

I have a simple UDP server implemented in python:

import socket sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.bind(("",10005)) while True: data = sock.recv(1024) 

I run this code on computer A. I send UDP commands from computer B in the following two situations:

  • Both A and B are connected to the router on the LAN via a LAN cable.
  • Both A and B are connected to the router via Wi-Fi.

UDP packets are received in situation 1 (LAN cable), but not in situation 2 (via Wi-Fi). In both cases, Wireshark shows the received packet on computer A. Any thoughts?

OS: Windows

Client program:

 import socket sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.sendto(char,("192.168.1.107",10005)) sock.close() 

I went to find a solution. Windows removes UDP packets. I checked with the netstat -s -p UDP command. Whenever the sending computer sends UDP packets, receiving errors increase. Now I just need to find out why the packets are being mistaken.

Edit I tested it on other computers. It is working. I turned on the firewall on the computer where it does not work, but still cannot figure out what the UDP packet is filtering.

+5
source share
1 answer

Check the Wi-Fi trust setting for the server machine. According to this article from Microsoft:

For example, a program that accepts incoming connections from the Internet (for example, a file sharing program) may not work in Public because the default setting for the Windows Firewall blocks all incoming connections to programs that are not on the list of allowed programs.

I believe that by default, Wi-Fi networks are placed in the Public profile, so it sounds like it's happening here. Since you know that the packet is there OK (form wireshark), the most likely explanation is that the firewall refuses to provide it for you.

An alternative would be to add python to the list of allowed programs if you may not fully trust the network.

0
source

Source: https://habr.com/ru/post/1210182/


All Articles