Connect to MD110 pbx using c# Socket Programming

176 Views Asked by At

I am trying to login Ericsson MD110 alex through the c# application. The md110 returned values that asking the username for login the application, but once I pass the username and password through the following code:

public static void Main(string[] args)
    {
        try
        {
            byte[] data = new byte[1024];
            string stringData;
            //TcpClient tcpclnt = new TcpClient();
            //Console.WriteLine("Connecting.....");
            string ipaddress = "192.168.1.30";
            int port=23;
            IPAddress ipadd = IPAddress.Parse(ipaddress);
            IPEndPoint ipend = new IPEndPoint(ipadd, port);

            Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            sock.NoDelay = false;

            sock.Connect(ipend);

            //recive data

            int recv = sock.Receive(data);
            stringData = Encoding.ASCII.GetString(data, 0, recv);

            //textBox4.AppendText(stringData + "\r\n");
            Console.Write(stringData);
            //while (true)
            //{

                Byte[] bBuf;
                string buf;


                //Application.DoEvents();
                //buf = String.Format("{0}\r\n{1}\r\n", "MDUSER", "HELP");

                buf = String.Format("ALREI;");
                //buf = string.Format("ENTER USER NAME<.MDUSER;MDUSER;ENTER PASSWORD<.HELP;");
                bBuf = Encoding.ASCII.GetBytes(buf);

                sock.Send(bBuf);     


                data = new byte[1024];
                recv = sock.Receive(data);
                stringData = Encoding.ASCII.GetString(data, 0, recv);
                //textBox4.AppendText(stringData + "\r\n");
                string df = "";
                Console.Write(stringData);
                Console.ReadLine();
            //}

        }

        catch (Exception e)      

          {
            Console.WriteLine("Error..... " + e.StackTrace);
            Console.ReadKey();
          }
    }

Further, I checked with wireshark, but md110 doesn't return any value. only acknowledge data packet will receive. I need some advice.

Command line output image

0

There are 0 best solutions below