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.

13 thoughts

  1. 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.

  2. 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!

  3. 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.

  4. 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

  5. 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!

  6. 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?

  7. 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.

  8. 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.

  9. 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")

  10. 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?!!

  11. 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.

Leave a Reply