Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 842107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:54:26+00:00 2026-05-15T05:54:26+00:00

I am using C# to receive data from a serial port but there are

  • 0

I am using C# to receive data from a serial port but there are some problems. I’m new to this so I need some help.

  1. First off all I want to know which functions are event driven:

    ReadExisting()
    Read()
    Readbyte() 
    Readchar()
    ReadLine()
    Readto()
    
  2. How can I take the required data form input stream of this port?

    I have static sized protocols. Can I use a special char to specify limits of a protocol data, and which will be a suitable char for this?

  3. How do I handle this exception:

    C# SerialPort System.ObjectDisposedException, safe handle has been closed in System.DLL

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T05:54:27+00:00Added an answer on May 15, 2026 at 5:54 am

    None of these methods are “event driven”, you’d use them in the DataReceived event. Which is called when the serial port has at least one byte of data available to read.

    Not sure what “static sized” means. If the device sends a fixed number of bytes then you’d use the Read() method to read them. Pay attention to the return value, you’ll get only as many bytes as are available. Store them in a byte[] and append to that in the next DR event until you’ve got them all.

    If the device sends characters rather than bytes then you can usually take advantage of the NewLine property. Set it to the character or string that terminates the response. A linefeed (“\n”) is by far the most typical choice. Read the response with ReadLine(). No buffering is required in that case.

    You’ll get the ObjectDisposed exception when you close a form but don’t ensure that the device stops sending data. Be sure to use only BeginInvoke in the DataReceived event, not Invoke. And don’t call BeginInvoke if the form’s IsDisposed property is true.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DataGridView. Some of the cells receive their data from a serial
Here's some background on what I'm trying to do: Open a serial port from
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters
I have device connected through serial port to PC. Using c-kermit I can send
I am a newbie to modbus and need some help. I am trying to
I have a very simple class using HttpListener to receive an HTTP POST from
I have a DataGridView that displays data from a MS Access database. I'm using
I am attempting to pull some information from my tnsnames file using regex. I
I am using MulticastSocket to receive UDP Multicast packets. How can I determine to
How can I open a web-page and receive its cookies using PHP? The motivation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.