Skip to content

Connect c# with the hyper terminal ?

Essam Ali

Asked Feb 21, 2007, 8:07 AM EST6 answers
Share
LinkedInX
I need to connect C# to hyper terminal to mange mobile from a serial port so i need to know how to make c# give the hyper terminal commands to do what i need "i need to access mobile sms and send and recive them from the pc while mobile is connected :)

6 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Hello, the fallowing example work's by modem or direkt serial connection: using LoMan.IO static SerialStream ss = new SerialStream(); ss.Open("COM1"); // Set port settings ss.SetPortSettings("9600"); // Set timeout so read ends after 20ms of silence after a response ss.SetTimeouts(20, 0, 0, 0, 0); // Create the StreamWriter used to send commands StreamWriter sw = new StreamWriter(ss, System.Text.Encoding.ASCII); // Create the Thread used to read responses Thread responseReaderThread = new Thread(new ThreadStart(ReadResponseThread)); responseReaderThread.Start(); sw.Write("atdt 0815"); sw.Flush(); etc........... static void ReadResponseThread() { StreamReader sr = new StreamReader(ss, System.Text.Encoding.ASCII); try { for (;;) { // Read response from modem string response = sr.ReadLine(); Console.WriteLine("Response: " + response); } catch (ThreadAbortException) { } } With the sw.Write command you can send a string on the port you have selected on top. I have done a response thread that read the incoming data on the selected port. regards Euro.
    0
  • 0

    plz what is using LoMan.IO
    i dont ge it
    i use instade of it
    using system.io.ports;

    but i get that exception


    Error 1 'System.IO.Ports.SerialStream' is inaccessible due to its protection level 

    how i solve
     

    0
  • 0
    Hello, you are right, i have forget something. You need one more file. Give me your PM and i will sent you the file. regards Euro.
    0
  • 0
    thank u alot
    u can send to
    [email protected]
    and i wish if you send me a small project of that to be sre that it work well

    thankx alot
    0
  • 0
    Hello, could you please check your mail adresse ? i get en error by [email protected]. regards Euro.
    0
  • 0
    ok
    sry for it , it is correct i dont know why it do send
    any way
    try
    [email protected]
    0