Multiple concurrent telnet sessions
Tony Pryor
dpplgngr at gmail.com
Wed Dec 8 15:28:55 EST 2004
Hello,
Anyone know if running two client telnet sessions at the same time
should be an inherent problem? They don't seem to want to share a port
or are they trying to use the same console for interaction with the
connected servers?
-Tony
Hello from parent loop 1 ipaddress1
Hello from parent loop 2 ipaddress2
Hello from thread 1
Hello from thread 2
Unhandled exception in thread started by <bound method Telnet.listener
of <telnetlib.Telnet instance at 0xf6f8ea6c>>
Unhandled exception in thread started by <bound method Telnet.listener
of <telnetlib.Telnet instance at 0xf6f8eacc>>
Traceback (most recent call last):
File "telmt.py", line 34, in ?
time.sleep(60)
import thread, sys, time, telnetlib
def child(tid,ip):
print 'Hello from thread', tid
tn = telnetlib.Telnet()
tn.mt_interact()
tn.open(ip, 10001)
def clear(tn):
tn.write("AT")
tn.expect("OK")
tn.write("ATMC")
tn.expect("OK")
tn.expect("ATUCL")
tn.expect("OK")
clear(tn)
time.sleep(1)
tn.write("ATDI,15,00000000")
(unparsed, ack) = expect("DONE")
print unparsed
time.sleep(1)
clear(tn)
def parent(iplist):
i = 0
for ip in iplist:
i = i+1
tuple = (i, ip,)
thread.start_new_thread(child, tuple)
print 'Hello from parent loop', i, ' ', ip
iplist = ["ip.ad.dr.1", "ip.ad.dr.2"]
parent(iplist)
time.sleep(60)
More information about the Python-list
mailing list