Python udp connection
Version vom 18. Dezember 2017, 17:51 Uhr von Thomas (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „<pre> #!/usr/bin/python import socket UDP_IP = "127.0.0.1" UDP_PORT = 999 MESSAGE = "Hello, World!" print "UDP target IP:", UDP_IP print "UDP target port:",…“)
#!/usr/bin/python
import socket
UDP_IP = "127.0.0.1"
UDP_PORT = 999
MESSAGE = "Hello, World!"
print "UDP target IP:", UDP_IP
print "UDP target port:", UDP_PORT
print "message:", MESSAGE
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))