Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Reading from a HyperTerminal in C#?

Posted on 2007-03-22
2
Medium Priority
?
3,540 Views
Last Modified: 2013-12-17
I'm having a problem with a C# program, I've connected a cross-over cable into my COM1 and COM2 ports so that I can open two HyperTerminal windows and have them communicate with each other, is it at all possible to write a program in C# that will be able to read the information that is sent to the HyperTerminal and store the information in a file or in some other way?
0
Comment
Question by:Richardsc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
_Eyeball_ earned 500 total points
ID: 18770882
Yes and no.

If you want to listen what the hyperterminals are talking no. That's because the hyperterminal blocks the port and you cant use it anymore

If you only want to listen to what the hyperterminal sends it's pretty easy...

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        private static System.IO.Ports.SerialPort m_Listener;

        static void Main(string[] args)
        {
            m_Listener = new System.IO.Ports.SerialPort();


            m_Listener.PortName = "COM1";
           
            // ... set all Informations you need

            // Register Event
            m_Listener.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(OnDataReceived);


            try
            {
                m_Listener.Open();
                Console.WriteLine("Successful opened");
            }
            catch
            {
                Console.WriteLine("Error while opening");
            }
            finally
            {
                Console.ReadLine(); // Waiting till user press Enter
                m_Listener.Close();              
            }
        }

        private static void OnDataReceived(
            object sender, System.IO.Ports.SerialDataReceivedEventArgs args)
        {
            // Create Filestream here and write bytes to file
        }
    }
}
0
 

Author Comment

by:Richardsc
ID: 18771093
I was hoping there would be some way around HyperTerminal blocking the port. Oh well. What you've given me here is a great help.

Thank you.
0

Featured Post

PowerShell Core for Advanced Linux Administrators

Understand advanced principals around Powershell Core with a focus on the Linux Administrator.  This course covers how to administer numerous environments across multiple platforms including Linux, Azure, AWS, and Google Cloud from a single shell instance.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question