Skip to content

Commit

Permalink
Add udp-client.py
Browse files Browse the repository at this point in the history
  • Loading branch information
hackerwhale committed Jul 6, 2023
1 parent 928938b commit fed2779
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions blackhat-python3/chapter2 - Network Basics/UDP-Client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import socket

target_host = "127.0.0.1"
target_port = 80

# create a socket object
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

# send some data
client.sendto("AAABBBCCC".encode(), (target_host, target_port))

# receive some data
data, addr = client.recvfrom(4096)
print(data.decode())

0 comments on commit fed2779

Please sign in to comment.