user2502954
user2502954

Reputation:

Python UDP Network not receiving data

Computer A "sender":

import socket
UDP_IP = "computer b ip address"
UDP_PORT 5005
MESSAGE = "HELLO!"

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

while True:
    sock.sendto((bytes(MESSAGE, 'UTF-8')), (UDP_IP, UDP_PORT))

Computer B "receiver":

import socket
UDP_IP = "computer b ip address"
UDP_PORT = 5005

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((UDP_IP, UDP_PORT)) 

while True:
    data = sock.recv(1024)
    print("received: ", data)

Observations

Can anyone give me direction in my attempt to send data between computer A and computer B using UDP?

Upvotes: 0

Views: 3291

Answers (1)

PankajM
PankajM

Reputation: 417

Try to check telnet serverip 4000 from your machine, to check if 4000 port is reachable. If not most likely it is firewall issue as pointed by Steffen.

Upvotes: 1

Related Questions