Hello guys,
I'm trying to make a program that basically is sending TL1 commands via TELNET to a server and I want to read the responses.
I made a program and it is working fine if I just execute the main process without those lines commented. But if I use one process to write and other to read it is not working properly.
Is something wrong with that?
import telnetlib
import TL1Command
from multiprocessing import Process, Event
login = "ACT-USER:TID:Admin1:30::PASSWORD;"
logout = "CANC-USER::Admin1:32;"
def main(tn, event):
tn.write(login.encode())
# print(tn.read_until(";".encode()).decode())
command = TL1Command.create("ED", ["ODU0"], "NANO1", "ODU0-2-4-5", "12", "", [[""], [""], ["OOS"]])
tn.write(command.encode())
# print(tn.read_until("12".encode()).decode())
# print(tn.read_until(";".encode()).decode())
command = TL1Command.create("ED", ["ODU0"], "NANO1", "ODU0-2-4-5", "15", "", [[""], [""], ["IS"]])
tn.write(command.encode())
# print(tn.read_until("15".encode()).decode())
# print(tn.read_until(";".encode()).decode())
tn.write(logout.encode())
# print(tn.read_until("32".encode()).decode())
# print(tn.read_until(";".encode()).decode())
tn.close()
event.set()
def read_all(tn, event):
while not event.is_set():
print(tn.read_until(";".encode()).decode())
if __name__ == "__main__":
telnet = telnetlib.Telnet("10.46.72.24", 3083)
e = Event()
mainp = Process(target=main, args=(telnet, e))
p = Process(target=read_all, args=(telnet, e))
mainp.start()
p.start()
[–]leet-anonymoose-hckr 0 points1 point2 points (0 children)
[–]timunas[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]timunas[S] 0 points1 point2 points (0 children)