Hallo Leute ich mache grade ein kleines spaß script in python, enthalten sind Master und Client.
Auf meinem PC hat alles geklappt, also habe ich es auf einer virtuellen Maschine auch noch getestet, allerdings hat es dort nicht geklappt.
Dabei kam der Fehler:"socket.gaierror: [Errno 110001] getaddirinfo failed" raus.
Master:
import time
import sys
import socket
import os
s = socket.socket()
host = socket.gethostname()
print("host")
port = 8080
s.bind((host,port))
print("")
print("Waiting for any incoming connections ... ")
print("")
s.listen(1)
conn, addr = s.accept()
print("")
print(addr, " - Has connected to the server")
print("")
command = input(str("Command : "))
conn.send(command.encode())
print("Command has been sent successfully. Waiting for confirmation")
print("")
data = conn.recv(1024)
if data:
print("Command has been recieved and executed")
print("")
Client:
import time
import sys
import socket
import os
s = socket.socket()
host = socket.gethostname()
port = 8080
s.connect((host,port))
print("")
print(" Connected to server ")
command = s.recv(1024)
command = command.decode()
if command == "kill":
print("")
print("Shutdown command")
s.send("command recieved".encode())
os.system("testlol.txt")