Blog

13May
2005
Creating A Telnet Gateway

A CFC that accepts text input and returns text responses can easily be made accessible via Telnet. This is what you'll need to do:

1) Make a copy of /cfusionmx7/gateway/config/socket.cfg (name it telnet.cfg perhaps), and then edit the copy and change the port: port=23.

2) Create a new gateway instance of type "TCP/IP Socket", give it a unique name, point it at the telnet.cfg config file, and at your CFC file.

3) Start the new gateway instance.

4) Use a Telnet client to connect to your ColdFusion server (specify DNS name or IP address).

That should do it.

Comments (13)



  • Yacoubean

    That's pretty cool. I'm trying to think of an instance where it would be useful, but I guess that's not always the point. ;) I guess there could be cases were people are pretty limited in what tools they have available to them, and telnet is the perfect answer.

    #1Posted by Yacoubean | May 13, 2005, 04:39 PM
  • Sean Corfield

    I built a primitive debugger using this approach which I demo'd at the 2004 Fusebox conference. Essentially the onIncomingMessage() method just called evaluate() on anything typed in and returning the result as a string.

    The possibilities offered by the event gateways are just amazing!

    #2Posted by Sean Corfield | May 14, 2005, 03:04 AM
  • Jason Hung

    I'm looking to do something like this, except using the SSH protocol. I'm guessing I would need to find out how SSH encrypts communications, for a start.

    #3Posted by Jason Hung | May 16, 2005, 07:04 PM
  • David

    hi,please help me about how cfchart tag can been displayed in cfform? I want to write a poll application with richform.Thanks very much

    #4Posted by David | May 16, 2005, 11:11 PM
  • John Farrar

    Is there a way we could use this for making a CVS tools for project management with CF? This would be a BIG advantage for open source projects done in CF!

    #5Posted by John Farrar | May 30, 2005, 08:06 AM
  • Sean Corfield

    Jason, you would need a new event gateway, written in Java, that handles the SSH protocol.

    John, can you explain what you mean? Are you suggesting writing a CVS pserver entirely in CF?

    #6Posted by Sean Corfield | May 30, 2005, 02:42 PM
  • rob

    Jason,

    Should be easy. Look at some SSH libraries for Java. One thing to note.. like the telnet example or the SSH example gateways are async so if your expecting something like a real telnet client where you can make a request and get a request right back on the same connection then you dont want to use a gateway. Gateways are good for if you need to lets create a form allowing you to send commands to a telnet server where you dont care if you get a result passed back to you from the telnet server.

    #7Posted by rob | Dec 8, 2005, 05:46 PM
  • Anuj Gakhar

    Ben, Thats really cool. Rather very innovative idea I must say. Can be useful if some external systems need to interact with Coldfusion for just getting and receiveing some sort of text messages. Good stuff.

  • tony shelton

    can this be used to create a web-based method of obtaining results for running a script from a windows platform to a unix box? (i.e. can i send a command like "cd /wwwroot/folderB" and "ls" to obtain files in "folderB")

    #9Posted by tony shelton | Jan 18, 2008, 04:00 PM
  • Michael Ratner

    Ben help! i need to connect to my aquariums electronic controller that sits on port 23 on an ip on my home network.

    with CF i want to automate logging in with the username and password prompts that come up and pass a simple command. For example C gives me the current temp, ph, etc of my tank.

    How can i pass the username, pw, command to the ip/port and pull the data returned into a variable to process???

    Thanks Guys?!!

  • Mike

    Is there anyway to initiate a socket connection from coldfusion?
    I have some devices that I want to have coldfusion log into and run some commands on but the only way to access them is through telnet.

    #11Posted by Mike | Nov 2, 2008, 12:52 AM
  • Ben Forta

    CF dos not have that built in, but you could call Java classes to do that.

    --- Ben

    #12Posted by Ben Forta | Nov 12, 2008, 01:38 PM
  • replica hangbags

    http://www.mybagsvip.com
    http://www.aimbags.com
    http://www.watchvisa.com