[IronPython] Telnet API

Mark Rees mark.john.rees at gmail.com
Wed Sep 27 06:20:13 CEST 2006


Seo has a select module that workes with IronPython, but there are
also other issues with telnetlib relating to how it's uses sys.stdin
which I do not have time to investigate at the moment.

But you could use the following open source assembly as the basis for
a telnet IP library.

http://dotnettelnet.sourceforge.net/

The following is an IronPython version of the example they provide:

import clr
clr.AddReference("Telnet")
import De.Mud.Telnet as Telnet
import sys

done = False

def on_disconnect(sender, e):
    print "Disconnected"
    global done
    done = True
    print "Press <Enter> to quit"

def on_data_available(sender, e):
    print e.Data

tn = Telnet.TelnetWrapper()

tn.Disconnected += on_disconnect
tn.DataAvailable += on_data_available
tn.TerminalType = "xterm"
tn.Hostname = "unikorn.css.net"
tn.Port = 23

tn.Connect()

tn.Receive()

while not done:
    tn.Send(raw_input() + tn.CR)

Regards

Mark


On 9/27/06, Martin Maly <Martin.Maly at microsoft.com> wrote:
>
>
>
> Telnetlib is a module implemented in Python so ideally IronPython should be
> able to run it. At this point, however, there is a module "select" that
> telnetlib depends on and IronPython doesn't support so IronPython cannot run
> telnetlib.
>
>
>
> Martin
>
>
>
>
> From: users-bounces at lists.ironpython.com
> [mailto:users-bounces at lists.ironpython.com] On Behalf Of
> Yan Manevich
> Sent: Tuesday, September 19, 2006 5:45 PM
> To: users at lists.ironpython.com
> Subject: [IronPython] Telnet API
>
>
>
>
> Hello,
>
>
>
> I want to connect through Telnet from Windows machine to UNIX machine and
> run some scripts on the last one. My question is if that is possible to work
> with Telnet from IronPython? Is there any API in IronPython like telnetlib
> in Python2.4.3?
>
>
>
> Thank you in advance for you answers.
>
> Yan
> _______________________________________________
> users mailing list
> users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>



More information about the Ironpython-users mailing list