xbee packet transmission using c#.Net

hi
I am not very familiar to the programming . I am using xbee series 1 pro and set 1 xbee as an transmitter and other as an receiver …I have design and check the packets which toggle the op pin of receiver …and they are working perfectly fine
was trying to put D4 pin high
Now i want to transmit these packets using c# coding …

namespace xbee
{
    class Program
    {
       static SerialPort port = new SerialPort("COM9", 9600, Parity.None, 8, StopBits.One);
        static void Main(string[] args)
        {
            // Instantiate the communications
// port with some basic settings 
           
           port.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived);
            // Open the port for communications 
            port.Open(); // Write a string 
            port.Write("+++");
            System.Threading.Thread.Sleep(1000);
           // port.ReadLine();
            //port.WriteLine("AT" + Convert.ToChar(13));
            //System.Threading.Thread.Sleep(1000);
            Byte[] b = new  byte[]{0x7E, 0x00, 0x10, 0x17, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF , 0xFF , 0xFE , 0x02 , 0x44 , 0x34 , 0x05 , 0x6D};
           port.Write(b,0,b.Length);
           System.Threading.Thread.Sleep(1000);
            port.Write("~       ÿÿÿ FE;D4m"+Convert.ToChar(13));
            //port.Write("0x7E00101701000000000000FFFFFFFE024434056D"+Convert.ToChar(13));
            System.Threading.Thread.Sleep(1000);
            //port.ReadLine();
            //Console.WriteLine(port.ReadLine());
           // port.Write(new byte[] {0x0A, 0xE2, 0xFF}, 0, 3);
            
            Console.WriteLine("Press any key to close this app..");
            Console.ReadLine();
            // Close the port
            port.Close();
        }

        static void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            Console.WriteLine(e.EventType.ToString());
           Console.WriteLine(port.ReadExisting());
           // Console.WriteLine((char)port.ReadByte());
        }
    }
}


I am getting CHARS
OK
Press any key to close this app…
IN RESPONCE
the packet is not transferring … did everything i could :frowning:

When I first started with the xbees, I had trouble getting the DataReceived event to fire. You might try:

  1. Giving your port a Handshake value other than none. (RequestToSend)

or

  1. For now, just do a simple serial port read and write results to console within your Main after you Write.

I’d try #2 first, actually.