Solved

Whats the Difference between Readline and readexisting

Posted on 2011-09-02
3
2,328 Views
Last Modified: 2012-08-13
I have setup a com port read property and trying to send a signal from my external device to my PC. When I use the com port readline I cannot see anything over the com port, however when I use the readexisting I can see the data over the com port. Whats the difference?
0
Comment
Question by:cmdolcet
[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
3 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 63 total points
ID: 36476850
ReadExisting gets any data that is lying in the receive buffer.

ReadLine waits until it detects an end of line value in the data. If data has been received but there was no end of line code in the data, Readline returns nothing. This makes it easier to read text line by line, because the system takes care of identifying the end of each line.

If the type of data you receive is not made of  text, ReadLine is useless. It might never trigger, because the com port might never receive end of line values. And if it does (usually values 13 and/or 10), they won't really represent and and of line, they are probably only those values in binary data.
0
 

Author Comment

by:cmdolcet
ID: 36477889
I know my data end of line is a CR would this be the same?
0
 
LVL 63

Assisted Solution

by:Fernando Soto
Fernando Soto earned 62 total points
ID: 36477947
Hi cmdolcet;

The SerialPort.ReadLine Method expects to see a NewLine to mark the end of the string. The new line is a sequence of two characters, \r\n, which represents a Cr and Lf NOT just a CR and is the reason why you are not seeing any response on the line.

Fernando
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
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.

626 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