Python Forum
Reading UDP from external device without device software
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reading UDP from external device without device software
#2
I figured it out! Pardon me for replying on my own post but I thought people might appreciate it if they ever stumble upon this same problem ;) See below for the code I used:
import socket

UDP_IP = "10.0.0.37" #the IP of the ethernetport of the pc
UDP_PORT = 30002  # the receiving port on the pc

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

while True:
    data, addr = sock.recvfrom(4096) # buffer size is 4096 bytes
    print("received message:", data)
replace the UDP_IP and UDP_port with your own values ofcourse
Reply


Messages In This Thread
RE: Reading UDP from external device without device software - by ikdemartijn - Dec-03-2019, 02:01 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Input network device connection info from data file edroche3rd 6 1,067 Oct-12-2023, 02:18 AM
Last Post: edroche3rd
  How to automate loop test check on Network device jpc230 1 589 Oct-09-2023, 09:54 PM
Last Post: Larz60+
  Name of USB device on Anodrid frohr 0 706 Aug-14-2023, 06:36 AM
Last Post: frohr
  Help with bleak - how to send test to BLE device? korenron 1 1,745 Aug-28-2022, 11:28 PM
Last Post: Larz60+
  Scan for Bluetooth device korenron 0 2,629 Jan-10-2022, 01:06 PM
Last Post: korenron
  Sending string commands from Python to a bluetooth device Rovelin 13 9,531 Aug-31-2021, 06:40 PM
Last Post: deanhystad
  Python BLE Scanner not detecting device alexanderDennisEnviro500 0 2,015 Aug-01-2021, 02:29 AM
Last Post: alexanderDennisEnviro500
  Real Time Audio Processing with Python Sound-Device not working Slartybartfast 2 4,002 Mar-14-2021, 07:20 PM
Last Post: Slartybartfast
  Connect device using Visa TCP Socket connection d777py 1 3,440 Jan-08-2021, 05:08 PM
Last Post: d777py
  bluetooth device inquiry anne 0 2,347 Aug-01-2020, 12:24 AM
Last Post: anne

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020