Home > Back-end >  Python UDP socket destination unreacheable
Python UDP socket destination unreacheable

Time:01-06

I am programming program which has to be controlled by UDP shell. I've got receive part correctly all seems to work, but the sending part doesn't seem to work. I've checked up with wireshark and got following result:1

Code:

def send(command):
        global ipv4
        global port
        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        sock.connect((ipv4, int(port)))
        sock.send(bytes(command, 'utf-8'))

Is it caused by code or by my router? Router: D-LINK Model: DIR-X1560

Note: Both sending computer and receiving one have linux on them.

CodePudding user response:

The problem was in the receiver linux doesn't seem to accept creating socket on router dhcp assigned ipv4 which was reserved by me on '192.168.0.116' and even local ip '127.0.0.1' the socket only truly opened with address '0.0.0.0'.

  •  Tags:  
  • Related