Multiple concurrent telnet sessions

T

Tony Pryor

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)
 
L

Lee Harr

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?

I don't know if it will work, but have you looked at using
twisted for networking? If nothing else, someone on the
twisted mailing list may be able to point you in the right
direction...

http://twistedmatrix.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top