• Uncategorized

About python : Python-UDP-socket-destination-unreacheable

Question Detail

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:

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.

Question Answer

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’.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.