hi every body,
i need some help and i hope you can help me.
because i started to programming a little tool in c# to send some telnet commends to my fritz.box 7141 to controll the led-lights. but in my programm in dosn´t works an i don´t know why.
i wont to send the commend "echo 1,3 > /dev/new_led" and "echo 1,4 > /dev/new_led"
my fritzbox ip is 192.168.178.1 port 23
the connection works but nothing else. can you find my mistake? i be lost with the problem... how can i send my orders via telnet ?
Thank you for help!!!! and sry for my bad english
i i want to do is via c#
http://www.youtube.com/watch?v=3cDZNmpAghA[
^]
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
public class SimpleTcpClient
{
public static void Main()
{
byte[] data = new byte[1024];
string input, stringData;
Console.WriteLine("IP-adresse eingeben.");
IPEndPoint ipep = new IPEndPoint(IPAddress.Parse("192.168.178.1"),23);
Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
try
{
server.Connect(ipep);
}
catch (SocketException )
{
Console.Clear();
Console.WriteLine("\n Verbindung zu Experience 0O9 fehlgeschlagen ");
Console.WriteLine(" mögliche fehler:\n");
Console.WriteLine(" -Fehlerhafte IP-adresse");
Console.WriteLine(" -Experience 0O9 nicht gestartet");
Console.WriteLine(" -W-lan Deaktivirt oder nicht verfügbar");
Console.WriteLine(" -Gerät außer Reichweite\n");
Main();
}
int recv = server.Receive(data);
stringData = Encoding.ASCII.GetString(data, 0, recv);
Console.Clear();
Console.WriteLine("Verbunden");
while (true)
{
input = Console.ReadLine();
if (input == "esc")
break;
if (input == "w")
{ input = "echo 1,3 > /dev/new_led"; }
server.Send(Encoding.ASCII.GetBytes(input));
data = new byte[1024];
recv = server.Receive(data);
stringData = Encoding.ASCII.GetString(data, 1, recv);
Console.WriteLine(stringData);
}
Console.WriteLine("Disconnecting from server...");
server.Shutdown(SocketShutdown.Both);
server.Close();
}
}
Thank you for help!!!! and sry for my bad english