Category : udp

I am currently reading the book Black Hat Python. Here is the code that I am trying to execute: import socket target_host = ‘127.0.0.1’ target_port = 80 client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) client.sendto(b"AAABBBCCC", (target_host, target_port)) data, addr = client.recvfrom(4096) print(data) When I run it, it gives me this error: Traceback (most recent call last): File "simpleudpclientbhp.py", ..

Read more

I have a client and a server. The server sends a random number to the client and if it is less than 4, the client responds unsuccessfully. SERVER: import random from socket import * serverSocket = socket(AF_INET, SOCK_DGRAM) serverSocket.bind((”, 12000)) while True: rand = random.randint(2, 4) message, address = serverSocket.recvfrom(1024) message = (message.decode()+" СЛУЧАЙНОЕ ЧИСЛО: ..

Read more