#! /usr/bin/python3 # ================================================================== # from: www.youtube.com/watch?v=Lbfe3-v7yE0 # Sockets Tutorial with Python 3 part 1 - sending and receiving data # ================================================================== import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((socket.gethostname(),1234)) # adress/hostname and port print("Listening for connections") s.listen(5) while True: clientsocket,address = s.accept() print("Accepted connection from {}".format(address)) clientsocket.send(bytes("Welcome to the server!","utf-8")) clientsocket.close()