Notifications
Clear all

[Closed] telnet

Hej,

I would like to create a connection to slg a gpu based renderer (luxrender) through telnet.

My simplest option was that I use a telnet program with some script. Unfortunately this option didn’t really worked out. The commands for unknown reasons didn’t went through while connection was ok.

Can anybody advise me on this? Is there other ways to connect?

just to let you know it will be used to change materials on the fly. Awesome stuff!

Thx

11 Replies
 JHN

Sounds like something dotnet possibly could do, I don’t think maxscript has any real telnet connectivity.

-Johan

Sorry not to much time to dig into this but try looking at System.Net.Sockets

I’ve found telnet easiest in Python. Only a few lines of code to get the whole process going…

http://docs.python.org/library/telnetlib.html

I tie the python code into max using the com method shown in the first post of this thread.
http://forums.cgsociety.org/showthread.php?f=98&t=509631&page=1

Hej thanks but It would require a phyton installation for every user.
I tried to work out the Dotnet version – I am really new in this field – but I couldnt make it.

so here a simple class object creation and it wont work.
I downloaded a telnet dll which works. (I made sure)

dotnet.loadAssembly “c:\luxrender\ elnet.dll”
net = dotnetClass “System.Object.TelnetProtocolHandler”
net2 = dotNetObject net

at the second line I get the “Cannot resolve type: System.Object.TelnetProtocolHandler” error, which is strange because it should work.

anybody got a clue?

Thanks

A google search turned up an open source Telnet class library with this class found at http://dotnettelnet.sourceforge.net/ .
If this is what you are using the syntax for the class string would be:

"De.Mud.Telnet.TelnetProtocolHandle" 

in general, the syntax for dotnet class strings is in the form:

"Namespace.ClassName"

in this case the namespace of your class is “De.Mud.Telnet” as indicated on this page.
The page also shows that “TelnetProtocolHandle” class is a descendent of the “System.Object” class which I suspect is where you were confused.

there is a help file for it and its says the name space as above. (in my example)
your method returns undefined. I gues this is why.
Yes thats what I am trying to use.

NameSpace hirearchy

System.Object
-TelnetProtocolHandler
-TelnetWrapper

so after loading the assembly it returns
dotNetObject:System.Reflection.Assembly
And then as you see in the above post.

At the meantime I tried to use System.Net.Sockets.Socket is as well, but I couldnt figure out yet. Maybe I better take a short course on dotnet…

“System.Object” is a class called ‘Object’ in the ‘System’ namespace. This class is the base class of all dotnet classes. All ‘top level’ classes implicitly inherit from the “System.Object” class. This however does not mean that the namespace that the TelnetProtocolHandler belongs to is “System.Object” or even “System” for that matter. It was written in the “De.Mud.Telnet” namespace and so the class string in my previous post was correct.

Since you said it returns undefined, I downloaded the assembly to check and it turns out that TelnetProtocolHandler is an abstract class which means that you cannot create an instance of it using ‘dotnetobject’ and apparently maxscript does not allow you to reference abstract classes using ‘dotnetclass’. The solution is to use the TelnetWrapper class which inherits from the TelnetProtocolHandler and implements public properties, methods and events that you will need.

In short, use this:

dotnetobject "De.Mud.Telnet.TelnetWrapper"

Thanks a bunch! Thanks for teh education as well!

this worked wit hthe excpetion that after setting up host/port and then trying to connect max crashed… I am not sure if all toghether it works this way out with this dll.

Well, I just recognised that even in max the listener returns something weird it seems that the connection actually works. However on the host application nothing happens, only when I use the command close() the application notifies that “[telnet Server]An existing connection was forcibly closed by remote host”
So it does somehwhat works.

the code is

net = dotnetClass “De.Mud.Telnet.TelnetWrapper”
net2 = dotNetObject net
net2.hostname = “localhost”
net2.port = 18081
net2.connect()
net2.connected
net2.send(“render.stop”)
net2.close()
net2.connected

it is also interesting that when I ask for the params it just simply returns undefined.
for example after setting net2.hostname = “localhost” and looking up net2.hostname it will return undefined.

Seems weird. Do you happen to know an other small dll maybe?

Page 1 / 2