connecting to telnet and executing perl script [modified]
-
hi friends I have some perl scripts which are on unix machine. I need to connect to telnet and execute these perl scripts using C#. please help me for this... thanks
modified on Wednesday, February 24, 2010 3:59 AM
-
hi friends I have some perl scripts which are on unix machine. I need to connect to telnet and execute these perl scripts using C#. please help me for this... thanks
modified on Wednesday, February 24, 2010 3:59 AM
-
Firstly what has this to do with C#? Secondly what is your problem in using telnet?
txtspeak is the realm of 9 year old children, not developers. Christian Graus
firstly read the thread, i need to connect to telnet and execute the perl scripts which are on unix machine using C# i hope u will understand this
-
firstly read the thread, i need to connect to telnet and execute the perl scripts which are on unix machine using C# i hope u will understand this
He's asking what you've done so far. What code have you got? What's not working?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
-
He's asking what you've done so far. What code have you got? What's not working?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
// code is as follow, it executes without any exception but nothing happens at unix and i get the response as ??% all time string message = "./mahesh/touch test_connection1"; Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.Blocking = true; socket.Connect("10.111.16.199", 23); TelnetStream stream = new TelnetStream(socket); Byte[] data = System.Text.Encoding.ASCII.GetBytes(message); stream.Write(data, 0, data.Length); // String to store the response ASCII representation. String responseData = String.Empty; // Read the first batch of the TcpServer response bytes. Int32 bytes = stream.Read(data, 0, data.Length); responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes); Console.WriteLine("Received: {0}", responseData); // Close everything. stream.Close(); socket.Close();
-
// code is as follow, it executes without any exception but nothing happens at unix and i get the response as ??% all time string message = "./mahesh/touch test_connection1"; Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.Blocking = true; socket.Connect("10.111.16.199", 23); TelnetStream stream = new TelnetStream(socket); Byte[] data = System.Text.Encoding.ASCII.GetBytes(message); stream.Write(data, 0, data.Length); // String to store the response ASCII representation. String responseData = String.Empty; // Read the first batch of the TcpServer response bytes. Int32 bytes = stream.Read(data, 0, data.Length); responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes); Console.WriteLine("Received: {0}", responseData); // Close everything. stream.Close(); socket.Close();
What happens if you telnet to this normally? Does it prompt you for credentials?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
-
What happens if you telnet to this normally? Does it prompt you for credentials?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
thanks for reply.... it doesn't prompt for login..
-
thanks for reply.... it doesn't prompt for login..
-
hi friends I have some perl scripts which are on unix machine. I need to connect to telnet and execute these perl scripts using C#. please help me for this... thanks
modified on Wednesday, February 24, 2010 3:59 AM
I've had to telnet into Unix systems and run some automated stuff before. (Five years ago, with C# 1.0 and .net 1.1) I found a telnet client class somewhere, I'm not sure where, but probably not on CP. From that, I wrote my own and added the ability for it to execute command scripts -- with my own little scripting language. It worked just great with only a few minor problems. Unfortunately, my classes didn't get to a point where I felt I could write an article and publish them. I was actually working on that when I got laid off from that job. :^) Anyway, you need a telnet client class; just a socket won't do it. Does the current version of .net have a telnet client class? I haven't bothered to look. P.S. My Telnet client class wraps a TcpClient object.
modified on Wednesday, February 24, 2010 4:58 PM
-
// code is as follow, it executes without any exception but nothing happens at unix and i get the response as ??% all time string message = "./mahesh/touch test_connection1"; Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.Blocking = true; socket.Connect("10.111.16.199", 23); TelnetStream stream = new TelnetStream(socket); Byte[] data = System.Text.Encoding.ASCII.GetBytes(message); stream.Write(data, 0, data.Length); // String to store the response ASCII representation. String responseData = String.Empty; // Read the first batch of the TcpServer response bytes. Int32 bytes = stream.Read(data, 0, data.Length); responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes); Console.WriteLine("Received: {0}", responseData); // Close everything. stream.Close(); socket.Close();
l.laxmikant wrote:
TelnetStream
What namespace is it in?
-
hi friends I have some perl scripts which are on unix machine. I need to connect to telnet and execute these perl scripts using C#. please help me for this... thanks
modified on Wednesday, February 24, 2010 3:59 AM
Have you gotten it working? I got back to looking at my code yesterday and found that it isn't broken so I may be publishing it soon. If you found another class that does it could you let me know so I can check it out too?
-
hi friends I have some perl scripts which are on unix machine. I need to connect to telnet and execute these perl scripts using C#. please help me for this... thanks
modified on Wednesday, February 24, 2010 3:59 AM