Initial commit
This commit is contained in:
14
basic-udp/udp-dump.py
Normal file
14
basic-udp/udp-dump.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import socket, time
|
||||
|
||||
UDP_IP = "192.168.2.99"
|
||||
UDP_PORT = 5505
|
||||
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
#sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
|
||||
sock.bind((UDP_IP, UDP_PORT))
|
||||
|
||||
print(f"Listening on UDP port {UDP_PORT}...")
|
||||
|
||||
while True:
|
||||
data, addr = sock.recvfrom(1024)
|
||||
print(f"{time.ctime()} [{addr[0]}:{addr[1]}] {data.decode('utf-8', errors='replace')}")
|
||||
Reference in New Issue
Block a user