import socket

# Define server IP and port
host = socket.gethostname()
port = 9337

sock_ = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock_.bind((host, port))
sock_.listen(1)

print("\nServer started....")

# Accept connection and take in the connection and the addr
conn, addr = sock_.accept()

print("Connection established with: ", str(addr))

# Prepare and send message to the client, encode the message in ascii before sending
message = "\nThank you for connecting " + str(addr)
conn.send(message.encode("ascii"))
conn.close()
