Click here to Skip to main content
15,851,915 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hey guys! Here is my Problem, I`m working on interactive USSD with a GSM modem everything is fine but there is problem when i`m going to reply a USSD by my C# code.
on hyper Terminal everything is ok and work fine .
Hyper Terminal View :

1. Enable Roaming
2. Disable Roaming
after this , i have to write 1 or 2 then using Ctrl+Z to send my Reply
So hyperTerminal is ok
but I've been facing problem when try to implement Ctrl+Z into my code i think it`s correct but it does n`t work
serialPort.Write("2" + (char)13 + (char)26);

Iam Also using all tricks for sending Ctrl+Z it`s works but USSD Center Reply Invalid Request
//byte[] endbyte = new byte[1];
         //endbyte[0] = 0x1A;

        // serialPort.Write(char.ConvertFromUtf32(26));
         //char[] arr = new char[1];

         //arr[0] = (char)26; //ascii value of Ctrl-Z

        // serialPort.Write(arr, 0, 1); //array, start, length

Thank you All guys.

1 solution

CTRL-Z is simply the character 26, not 2 characters. You can do either:

SerialPort.Write("2" + (char)26);



Share this answer
Mohammad Reza Valadkhani 28-Jul-13 1:36am    
Thank you for your comment ,I've tried them before ! and i've check it again, the problem still exist , it sends correct values but i don't know why i can't get same result as hyperterminal.
Mohammad Reza Valadkhani 28-Jul-13 2:46am    
thank you for your reply it`s fixed there is problem into my port writing method

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900