Python socket works over LAN but not over Wifi
Question: 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 these
two situations:

  1. Both A and B are connected to a router in a local network via LAN cable. 
  2. Both A and B are connected to router over Wifi.

The UDP packets are received in situaltion 1 (LAN Cable) but not in situation
2 (over Wifi). **In both the cases Wireshark shows the received packet on
computer A.** Any thoughts?

OS: Windows

**The client program:**

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

I have come close to finding the solution. Windows is dropping the UDP
packets. I checked with `netstat -s -p UDP` command. Whenever the sending
computer sends the UDP packets, the Receive Errors increase. Now I just have
to figure out why the packets are being received erroneously.

**Edit** I have tested it on other computers. It works. I have switched of the
firewall on the computer where it doesn't work but still can not figure out
what is filtering out the UDP packet.


Answer: Check the trust setting on the Wifi network for the server machine. According
to [this article](http://technet.microsoft.com/en-us/library/cc731634.aspx)
from Microsoft:

> For example, a program that accepts inbound connections from the Internet
> (like a file sharing program) may not work in the Public profile because the
> Windows Firewall default setting will block all inbound connections to
> programs that are not on the list of allowed programs.

I believe by default Wifi networks are put in the Public profile, so it sounds
like what's happening here. Since you know the packet is getting there OK
(form wireshark), the most likely explanation is that the firewall refuses to
deliver it for you.

The alternative would be to add python to the [allowed programs
list](http://windows.microsoft.com/en-gb/windows/communicate-through-windows-
firewall#1TC=windows-7) if you are perhaps not wholly trusting of the network.

