22 lines
728 B
Python
22 lines
728 B
Python
|
import socket
|
||
|
|
||
|
# Create a UDP socket
|
||
|
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||
|
|
||
|
# Define the target host and port
|
||
|
host = '127.0.0.1'
|
||
|
port = 5060
|
||
|
|
||
|
# Create a bytes object
|
||
|
# this data was received from the internet in a test environmet...
|
||
|
data = [92, 46, 55, 124, 39, 30, 83, 52, 15, 99, 55, 66, 17, 90, 48, 115, 29, 51, 57, 19, 64, 111, 10, 87, 32, 108, 66, 36, 51, 11, 9, 15, 5, 64, 12, 44, 95, 95, 97, 110, 66, 24, 48, 83, 114, 97, 70, 16, 20, 127, 35, 84, 110, 45, 43, 15, 25, 110, 51, 76, 121, 60, 91, 127, 125, 103, 43, 92, 175, 183]
|
||
|
|
||
|
# ascii_chars = [chr(i) for i in data]
|
||
|
# print(''.join(ascii_chars))
|
||
|
|
||
|
# Send the bytes to the UDP port
|
||
|
sock.sendto(bytes(data), (host, port))
|
||
|
|
||
|
# Close the socket
|
||
|
sock.close()
|