Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- class UDP_server:
- def __init__(self):
- self.listenToClient()
- def listenToClient(self):
- with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as sock:
- sock.bind(("localhost", 14567))
- page = ""
- while True:
- data, addr = sock.recvfrom(1024)
- page = page + data.decode("utf-8")
- print(page)
- if __name__ == "__main__":
- UDP_server().__init__()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement